pyinstaller
Newbie here using Python 2.6.2 on MS WinXP Pro SP3. I'm trying create an frozen exec and was able to generate and exe file. python D:\pyinstaller-1.3\Makespec.py -F myprog.py python D:\pyinstaller-1.3\Build.py myprog.spec --paths=D: \pyinstaller-1.3;D:\PROJECTS\pyproject but when I ran myprog.exe i get this: Traceback (most recent call last): File string, line 2, in module File D:\pyinstaller-1.3\iu.py, line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File D:\pyinstaller-1.3\iu.py, line 398, in doimport exec co in mod.__dict__ File D:\PROJECTS\python.paging.system.client \buildpaging_system_client\out1.p yz/MySQLdb, line 19, in module File D:\pyinstaller-1.3\iu.py, line 312, in importHook mod = _self_doimport(nm, ctx, fqname) File D:\pyinstaller-1.3\iu.py, line 382, in doimport mod = director.getmod(nm) File D:\pyinstaller-1.3\iu.py, line 215, in getmod mod = owner.getmod(nm) File D:\pyinstaller-1.3\iu.py, line 77, in getmod mod = imp.load_module(nm, fp, attempt, (ext, mode, typ)) ImportError: _mysql: init failed ~~~ I have to source files namely: myprog.py mp3.py This is the content of spec file: a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), 'myprog.py'], pathex=['D:\\PROJECTS\\pyproject']) pyz = PYZ(a.pure) exe = EXE( pyz, a.scripts, a.binaries, name='myprog.exe', debug=False, strip=False, upx=False, console=True ) Please help. -- http://mail.python.org/mailman/listinfo/python-list
Re: pyinstaller
Renamed the project directory. from ... File D:\PROJECTS\python.paging.system.client \buildpaging_system_client\out1.p ... to ... File D:\PROJECTS\pyproject \buildpyproject\out1.p ... -- http://mail.python.org/mailman/listinfo/python-list
Re: pyinstaller
Imported files in myprog.py: import MySQLdb import os # works on Windows or Linux, also Vista import os.path import time import mp3 ~~~ Content of mp3.py: # -*- coding: utf-8 -*- #Michel Claveau import time from ctypes import windll, c_buffer class mci: def __init__(self): self.w32mci = windll.winmm.mciSendStringA self.w32mcierror = windll.winmm.mciGetErrorStringA def send(self,commande): buffer = c_buffer(255) errorcode = self.w32mci(str(commande),buffer,254,0) if errorcode: return errorcode, self.get_error(errorcode) else: return errorcode,buffer.value def get_error(self,error): error = int(error) buffer = c_buffer(255) self.w32mcierror(error,buffer,254) return buffer.value def directsend(self, txt): (err,buf)=self.send(txt) if err != 0: print'Error',str(err),'sur',txt,':',buf return (err,buf) ### def play(mp3file): xmci=mci() xmci.directsend('open ' + mp3file + ' alias toto') xmci.directsend('set toto time format milliseconds') err,buf=xmci.directsend('status toto length ') #print 'Duree du fichier : ',buf,' millisecondes' soundlength = int(buf) / 1000 err,buf=xmci.directsend('play toto from 0 to '+str(buf)) #time.sleep(int(buf)/1000) time.sleep(soundlength + 1) xmci.directsend('close toto') -- http://mail.python.org/mailman/listinfo/python-list
Re: pyinstaller
Content of warnmyprog.txt: W: no module named posix (conditional import by os) W: no module named optik.__all__ (top-level import by optparse) W: no module named readline (delayed, conditional import by cmd) W: no module named readline (delayed import by pdb) W: no module named pwd (delayed, conditional import by posixpath) W: no module named org (top-level import by pickle) W: no module named ctypes.windll (top-level import by mp3) W: no module named ctypes.c_buffer (top-level import by mp3) W: no module named posix (delayed, conditional import by iu) W: no module named fcntl (conditional import by subprocess) W: no module named org (top-level import by copy) W: no module named _emx_link (conditional import by os) W: no module named optik.__version__ (top-level import by optparse) W: no module named fcntl (top-level import by tempfile) W: __all__ is built strangely at line 0 - collections (C:\Python26\lib \collections.pyc) W: delayed exec statement detected at line 0 - collections (C: \Python26\lib\collections.pyc) W: delayed conditional __import__ hack detected at line 0 - doctest (C: \Python26\lib\doctest.pyc) W: delayed exec statement detected at line 0 - doctest (C: \Python26\lib\doctest.pyc) W: delayed conditional __import__ hack detected at line 0 - doctest (C: \Python26\lib\doctest.pyc) W: delayed __import__ hack detected at line 0 - encodings (C: \Python26\lib\encodings\__init__.pyc) W: __all__ is built strangely at line 0 - optparse (D: \pyinstaller-1.3\optparse.pyc) W: delayed __import__ hack detected at line 0 - ctypes (C: \Python26\lib\ctypes\__init__.pyc) W: delayed __import__ hack detected at line 0 - ctypes (C: \Python26\lib\ctypes\__init__.pyc) W: __all__ is built strangely at line 0 - dis (C:\Python26\lib \dis.pyc) W: delayed eval hack detected at line 0 - os (C:\Python26\lib\os.pyc) W: __all__ is built strangely at line 0 - __future__ (C:\Python26\lib \__future__.pyc) W: delayed conditional __import__ hack detected at line 0 - unittest (C:\Python26\lib\unittest.pyc) W: delayed conditional __import__ hack detected at line 0 - unittest (C:\Python26\lib\unittest.pyc) W: __all__ is built strangely at line 0 - tokenize (C:\Python26\lib \tokenize.pyc) W: delayed exec statement detected at line 0 - bdb (C:\Python26\lib \bdb.pyc) W: delayed eval hack detected at line 0 - bdb (C:\Python26\lib \bdb.pyc) W: delayed eval hack detected at line 0 - bdb (C:\Python26\lib \bdb.pyc) W: delayed __import__ hack detected at line 0 - pickle (C: \Python26\lib\pickle.pyc) W: delayed __import__ hack detected at line 0 - pickle (C: \Python26\lib\pickle.pyc) W: delayed conditional exec statement detected at line 0 - iu (D: \pyinstaller-1.3\iu.pyc) W: delayed conditional exec statement detected at line 0 - iu (D: \pyinstaller-1.3\iu.pyc) W: delayed eval hack detected at line 0 - gettext (C:\Python26\lib \gettext.pyc) W: delayed __import__ hack detected at line 0 - optik.option_parser (D:\pyinstaller-1.3\optik\option_parser.pyc) W: delayed conditional eval hack detected at line 0 - warnings (C: \Python26\lib\warnings.pyc) W: delayed conditional __import__ hack detected at line 0 - warnings (C:\Python26\lib\warnings.pyc) W: __all__ is built strangely at line 0 - optik (D: \pyinstaller-1.3\optik\__init__.pyc) W: delayed exec statement detected at line 0 - pdb (C:\Python26\lib \pdb.pyc) W: delayed conditional eval hack detected at line 0 - pdb (C: \Python26\lib\pdb.pyc) W: delayed eval hack detected at line 0 - pdb (C:\Python26\lib \pdb.pyc) W: delayed conditional eval hack detected at line 0 - pdb (C: \Python26\lib\pdb.pyc) W: delayed eval hack detected at line 0 - pdb (C:\Python26\lib \pdb.pyc) -- http://mail.python.org/mailman/listinfo/python-list
Play MP3s from Windows
Hi, Newbie here. I copied and pasted the code below. But when I ran it I got this error: D:\python mp3.py Duree du fichier : 298919 millisecondes Traceback (most recent call last): File mp3.py, line 37, in module time.sleep(int(buf)/1000) ValueError: invalid literal for int() with base 10: '' The code: # -*- coding: utf-8 -*- import time from ctypes import windll, c_buffer class mci: def __init__(self): self.w32mci = windll.winmm.mciSendStringA self.w32mcierror = windll.winmm.mciGetErrorStringA def send(self,commande): buffer = c_buffer(255) errorcode = self.w32mci(str(commande),buffer,254,0) if errorcode: return errorcode, self.get_error(errorcode) else: return errorcode,buffer.value def get_error(self,error): error = int(error) buffer = c_buffer(255) self.w32mcierror(error,buffer,254) return buffer.value def directsend(self, txt): (err,buf)=self.send(txt) if err != 0: print'Erreur',str(err),'sur',txt,':',buf return (err,buf) mci=mci() mci.directsend('open d:\\Linger.mp3 alias toto') mci.directsend('set toto time format milliseconds') err,buf=mci.directsend('status toto length ') print 'Duree du fichier : ',buf,' millisecondes' err,buf=mci.directsend('play toto from 0 to '+str(buf)) time.sleep(int(buf)/1000) mci.directsend('close toto') #...@-salutations #-- #Michel Claveau Please help. I'm in the middle of a project and I wanted to use this. -- http://mail.python.org/mailman/listinfo/python-list
Re: Play MP3s from Windows
On Jun 20, 7:16 am, Arlie arli...@gmail.com wrote: Hi, Newbie here. I copied and pasted the code below. But when I ran it I got this error: D:\python mp3.py Duree du fichier : 298919 millisecondes Traceback (most recent call last): File mp3.py, line 37, in module time.sleep(int(buf)/1000) ValueError: invalid literal for int() with base 10: '' The code: # -*- coding: utf-8 -*- import time from ctypes import windll, c_buffer class mci: def __init__(self): self.w32mci = windll.winmm.mciSendStringA self.w32mcierror = windll.winmm.mciGetErrorStringA def send(self,commande): buffer = c_buffer(255) errorcode = self.w32mci(str(commande),buffer,254,0) if errorcode: return errorcode, self.get_error(errorcode) else: return errorcode,buffer.value def get_error(self,error): error = int(error) buffer = c_buffer(255) self.w32mcierror(error,buffer,254) return buffer.value def directsend(self, txt): (err,buf)=self.send(txt) if err != 0: print'Erreur',str(err),'sur',txt,':',buf return (err,buf) mci=mci() mci.directsend('open d:\\Linger.mp3 alias toto') mci.directsend('set toto time format milliseconds') err,buf=mci.directsend('status toto length ') print 'Duree du fichier : ',buf,' millisecondes' err,buf=mci.directsend('play toto from 0 to '+str(buf)) time.sleep(int(buf)/1000) mci.directsend('close toto') #...@-salutations #-- #Michel Claveau Please help. I'm in the middle of a project and I wanted to use this. By the way I using Python 2.6.2. -- http://mail.python.org/mailman/listinfo/python-list
Re: Play MP3s from Windows
On Jun 20, 8:07 am, Tim Harig user...@ilthio.net wrote: On 2009-06-19, Arlie arli...@gmail.com wrote: print 'Duree du fichier : ',buf,' millisecondes' You can obviously make sure that 'buf' can be accessed as a string. time.sleep(int(buf)/1000) The error seems to be having issues converting buf to an int. Could you possibly convert it to a string before converting it to an int? time.sleep(int(str(buf))/1000) I'm still getting same error. So I just did this: ... mci=mci() mci.directsend('open d:\\Linger.mp3 alias toto') mci.directsend('set toto time format milliseconds') err,buf=mci.directsend('status toto length ') print 'Duree du fichier : ',buf,' millisecondes' soundlength = int(buf) / 1000 err,buf=mci.directsend('play toto from 0 to '+str(buf)) #time.sleep(int(buf)/1000) time.sleep(soundlength) mci.directsend('close toto') -- http://mail.python.org/mailman/listinfo/python-list
Re: Play MP3s from Windows
On Jun 20, 8:48 am, MRAB pyt...@mrabarnett.plus.com wrote: Arlie wrote: Hi, Newbie here. I copied and pasted the code below. But when I ran it I got this error: D:\python mp3.py Duree du fichier : 298919 millisecondes Traceback (most recent call last): File mp3.py, line 37, in module time.sleep(int(buf)/1000) ValueError: invalid literal for int() with base 10: '' The code: # -*- coding: utf-8 -*- import time from ctypes import windll, c_buffer class mci: def __init__(self): self.w32mci = windll.winmm.mciSendStringA self.w32mcierror = windll.winmm.mciGetErrorStringA def send(self,commande): buffer = c_buffer(255) errorcode = self.w32mci(str(commande),buffer,254,0) if errorcode: return errorcode, self.get_error(errorcode) else: return errorcode,buffer.value def get_error(self,error): error = int(error) buffer = c_buffer(255) self.w32mcierror(error,buffer,254) return buffer.value def directsend(self, txt): (err,buf)=self.send(txt) if err != 0: print'Erreur',str(err),'sur',txt,':',buf return (err,buf) mci=mci() mci.directsend('open d:\\Linger.mp3 alias toto') mci.directsend('set toto time format milliseconds') err,buf=mci.directsend('status toto length ') print 'Duree du fichier : ',buf,' millisecondes' From the output it's clear that 'buf' contains '298919'. err,buf=mci.directsend('play toto from 0 to '+str(buf)) time.sleep(int(buf)/1000) From the output it's clear that 'buf' contains ''. Are you expecting it to contain the length, like it did for the previous call? Perhaps you should just use the length returned by the previous call. I actually did that and it's working fine now. Thanks. mci.directsend('close toto') I just got the program from the web. I have never program in python but I'm taking the risk of replacing an existing perl program for a more readable code. As of now everything seems like a haze to me. I have read python tutorial just yesterday. I'm due to deliver this project in 36 hours or less. This is suppose to download mp3 file to client then connect to mysql get the person info and play appropriate mp3 for that person calling his full name. -- http://mail.python.org/mailman/listinfo/python-list