pyinstaller

A

Arlie

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.
 
A

Arlie

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
....
 
A

Arlie

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')
 
A

Arlie

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top