pyinstaller fails to create exe-File

D

DierkErdmann

Hi !

I am trying to create an exe file using pyinstaller. Running the
created exe-File gives the error message
""
Traceback (most recent call last):
File "<string>", line 8, in <module>
File "E:\Documents\mich\job\abs\backup_skript\buildbackup\out1.pyz/
email", lin
e 79, in __getattr__
File "D:\Programme\pyinstaller\iu.py", line 334, in importHook
raise ImportError, "No module named %s" % fqname
ImportError: No module named email.mime.multipart
""

My python-Skript uses the following imports:
import ConfigParser
import glob
import os
import smtplib
import time
import win32api
import zipfile
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders

Can someone help? Running
python script.py
works without any problems.

I have also tried to use py2exe, but
python setup.py py2exe
gives the following error message:

copying d:\programme\python25\lib\site-packages\py2exe\run.exe -> E:
\Documents\m
ich\job\abs\backup_skript\dist\backup.exe
Traceback (most recent call last):
File "setup.py", line 4, in <module>
setup(console=["backup.py"])
File "d:\programme\python25\lib\distutils\core.py", line 151, in
setup
dist.run_commands()
File "d:\programme\python25\lib\distutils\dist.py", line 974, in
run_commands
self.run_command(cmd)
File "d:\programme\python25\lib\distutils\dist.py", line 994, in
run_command
cmd_obj.run()
File "D:\programme\Python25\Lib\site-packages\py2exe\build_exe.py",
line 223,
in run
self._run()
File "D:\programme\Python25\Lib\site-packages\py2exe\build_exe.py",
line 290,
in _run
self.create_binaries(py_files, extensions, dlls)
File "D:\programme\Python25\Lib\site-packages\py2exe\build_exe.py",
line 548,
in create_binaries
arcname, target.script)
File "D:\programme\Python25\Lib\site-packages\py2exe\build_exe.py",
line 788,
in build_executable
add_resource(unicode(exe_path), script_bytes, u"PYTHONSCRIPT", 1,
True)
RuntimeError: EndUpdateResource: Das System kann das angegebene Gerõt
oder die a
ngegebene Datei nicht ÷ffnen. (=System cannot find the specified
device or the file)

Thanks in advance.

Dierk
 
T

Thomas Heller

Hi !

I am trying to create an exe file using pyinstaller. Running the
created exe-File gives the error message
""
Traceback (most recent call last):
File "<string>", line 8, in <module>
File "E:\Documents\mich\job\abs\backup_skript\buildbackup\out1.pyz/
email", lin
e 79, in __getattr__
File "D:\Programme\pyinstaller\iu.py", line 334, in importHook
raise ImportError, "No module named %s" % fqname
ImportError: No module named email.mime.multipart
""

My python-Skript uses the following imports:
import ConfigParser
import glob
import os
import smtplib
import time
import win32api
import zipfile
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders

Can someone help? Running
python script.py
works without any problems.

There have been large changes to the email module in Python 2.5,
see the NEWS.txt file. email's __init__.py module does some import
hacks to ensure compatibility with previous versions, unfortunately
the packagers cannot handle them automatically. It /may/ be possible
to write a package hook for pyinstaller, I do not know.

For py2exe at least, the best solution currently is to include the whole
email package; this can be done with '-p email' on the command line, or
by passing the corresponding option to the setup function.
I have also tried to use py2exe, but
python setup.py py2exe
gives the following error message:

copying d:\programme\python25\lib\site-packages\py2exe\run.exe -> E:
\Documents\m
ich\job\abs\backup_skript\dist\backup.exe
Traceback (most recent call last):
File "setup.py", line 4, in <module>
setup(console=["backup.py"])
File "d:\programme\python25\lib\distutils\core.py", line 151, in
setup
dist.run_commands()
File "d:\programme\python25\lib\distutils\dist.py", line 974, in
run_commands
self.run_command(cmd)
File "d:\programme\python25\lib\distutils\dist.py", line 994, in
run_command
cmd_obj.run()
File "D:\programme\Python25\Lib\site-packages\py2exe\build_exe.py",
line 223,
in run
self._run()
File "D:\programme\Python25\Lib\site-packages\py2exe\build_exe.py",
line 290,
in _run
self.create_binaries(py_files, extensions, dlls)
File "D:\programme\Python25\Lib\site-packages\py2exe\build_exe.py",
line 548,
in create_binaries
arcname, target.script)
File "D:\programme\Python25\Lib\site-packages\py2exe\build_exe.py",
line 788,
in build_executable
add_resource(unicode(exe_path), script_bytes, u"PYTHONSCRIPT", 1,
True)
RuntimeError: EndUpdateResource: Das System kann das angegebene Gerõt
oder die a
ngegebene Datei nicht ÷ffnen. (=System cannot find the specified
device or the file)

That's a different problem; it has nothing to do with the email package.
You should try to clean the dist and build directories that py2exe creates,
sometimes this helps. If it still does not work, you should try to find
out what the error means. Is the file readonly? locked because still in use?

Thomas
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top