problem mit py2exe / pyinstaller und modul email

Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
Antworten
Frank aka Ch3ck3r
User
Beiträge: 49
Registriert: Dienstag 13. November 2007, 21:56
Wohnort: Berlin
Kontaktdaten:

hi

Ich habe ein EmailProgramm geschrieben mit den Modulen smtplib und email.
Das ganze ist ziemlich groß deshalb hier: http://nopaste.com/p/aV2CJKMJo

Nun zum Problem. Wenn ich das ding nun mit PyInstaller oder Py2Exe umwandel bekomm ich den Fehler das er email.MIMEMUltipart.MIMEMultipart('related') nicht kennt

Beim kompilieren habe ich diese Fehlermeldung bekommen
W: no module named posix (conditional import by os)
W: no module named optik.__all__ (top-level import by optparse)
W: no module named fcntl (top-level import by tempfile)
W: no module named readline (delayed, conditional import by cmd)
W: no module named rourl2path (conditional import by urllib)
W: no module named readline (delayed import by pdb)
W: no module named pwd (delayed, conditional import by posixpath)
W: no module named termios (top-level import by getpass)
W: no module named org (top-level import by pickle)
W: no module named ic (delayed import by urllib)
W: no module named pwd (delayed import by getpass)
W: no module named posix (delayed, conditional import by iu)
W: no module named EasyDialogs (conditional import by getpass)
W: no module named SOCKS (top-level import by ftplib)
W: no module named email.MIMEMultipart (top-level import by __main__)
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 Carbon (conditional import by tempfile)
W: delayed exec statement detected at line 0 - bdb (C:\Python25\lib\bdb.pyc)
W: delayed eval hack detected at line 0 - bdb (C:\Python25\lib\bdb.pyc)
W: delayed eval hack detected at line 0 - bdb (C:\Python25\lib\bdb.pyc)
W: __all__ is built strangely at line 0 - optparse (C:\Dokumente und Einstellungen\Frank Zeche\Desktop\pyinstaller-1.3\optparse.pyc)
W: delayed conditional __import__ hack detected at line 0 - doctest (C:\Python25\lib\doctest.pyc)
W: delayed exec statement detected at line 0 - doctest (C:\Python25\lib\doctest.pyc)
W: __all__ is built strangely at line 0 - tokenize (C:\Python25\lib\tokenize.pyc)
W: delayed __import__ hack detected at line 0 - pickle (C:\Python25\lib\pickle.pyc)
W: delayed __import__ hack detected at line 0 - pickle (C:\Python25\lib\pickle.pyc)
W: delayed conditional eval hack detected at line 0 - gopherlib (C:\Python25\lib\gopherlib.pyc)
W: delayed __import__ hack detected at line 0 - encodings (C:\Python25\lib\encodings\__init__.pyc)
W: __all__ is built strangely at line 0 - dis (C:\Python25\lib\dis.pyc)
W: top-level exec statement detected at line 0 - hashlib (C:\Python25\lib\hashlib.pyc)
W: top-level conditional exec statement detected at line 0 - hashlib (C:\Python25\lib\hashlib.pyc)
W: delayed conditional eval hack detected at line 0 - warnings (C:\Python25\lib\warnings.pyc)
W: delayed conditional __import__ hack detected at line 0 - warnings (C:\Python25\lib\warnings.pyc)
W: delayed __import__ hack detected at line 0 - email (C:\Python25\lib\email\__init__.pyc)
W: name message_from_file not found - email (C:\Python25\lib\email\__init__.pyc)
W: name message_from_string not found - email (C:\Python25\lib\email\__init__.pyc)
W: name MIMEText not found - email (C:\Python25\lib\email\__init__.pyc)
W: name MIMENonMultipart not found - email (C:\Python25\lib\email\__init__.pyc)
W: name MIMEMultipart not found - email (C:\Python25\lib\email\__init__.pyc)
W: name MIMEMessage not found - email (C:\Python25\lib\email\__init__.pyc)
W: name MIMEImage not found - email (C:\Python25\lib\email\__init__.pyc)
W: name MIMEBase not found - email (C:\Python25\lib\email\__init__.pyc)
W: name MIMEAudio not found - email (C:\Python25\lib\email\__init__.pyc)
W: __all__ is built strangely at line 0 - wx (C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.pyc)
W: __all__ is built strangely at line 0 - wx (C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.pyc)
W: delayed exec statement detected at line 0 - pdb (C:\Python25\lib\pdb.pyc)
W: delayed conditional eval hack detected at line 0 - pdb (C:\Python25\lib\pdb.pyc)
W: delayed eval hack detected at line 0 - pdb (C:\Python25\lib\pdb.pyc)
W: delayed conditional eval hack detected at line 0 - pdb (C:\Python25\lib\pdb.pyc)
W: delayed eval hack detected at line 0 - pdb (C:\Python25\lib\pdb.pyc)
W: delayed conditional __import__ hack detected at line 0 - unittest (C:\Python25\lib\unittest.pyc)
W: delayed conditional __import__ hack detected at line 0 - unittest (C:\Python25\lib\unittest.pyc)
W: delayed conditional exec statement detected at line 0 - iu (C:\Dokumente und Einstellungen\Frank Zeche\Desktop\pyinstaller-1.3\iu.pyc)
W: delayed conditional exec statement detected at line 0 - iu (C:\Dokumente und Einstellungen\Frank Zeche\Desktop\pyinstaller-1.3\iu.pyc)
W: delayed __import__ hack detected at line 0 - optik.option_parser (C:\Dokumente und Einstellungen\Frank Zeche\Desktop\pyinstaller-1.3\optik\option_parser.pyc)
W: __all__ is built strangely at line 0 - optik (C:\Dokumente und Einstellungen\Frank Zeche\Desktop\pyinstaller-1.3\optik\__init__.pyc)
W: delayed exec statement detected at line 0 - socket (C:\Python25\lib\socket.pyc)
W: delayed eval hack detected at line 0 - os (C:\Python25\lib\os.pyc)
W: __all__ is built strangely at line 0 - __future__ (C:\Python25\lib\__future__.pyc)
W: delayed eval hack detected at line 0 - gettext (C:\Python25\lib\gettext.pyc)
Wie kann ich das teil denn nu zum laufen bringen? gibt es noch einen anderen Compiler?
kostenlose TS2-Server für jeweils 31 Tage:
http://www.ts-onlyfree.de
Leonidas
Python-Forum Veteran
Beiträge: 16025
Registriert: Freitag 20. Juni 2003, 16:30
Kontaktdaten:

Dann musst du py2exe eben manuell sagen, dass es ``email.MIMEMultipart`` mit einpacken soll.

Btw: py2exe ist kein Compiler im üblichen Sinne. Es ist ein "Freezer".
My god, it's full of CARs! | Leonidasvoice vs (former) Modvoice
Frank aka Ch3ck3r
User
Beiträge: 49
Registriert: Dienstag 13. November 2007, 21:56
Wohnort: Berlin
Kontaktdaten:

habe nun alle module angegeben

Code: Alles auswählen

# setup.py
from distutils.core import setup
import py2exe
setup(
    options = { "py2exe": {"packages" : ["wx",
                                         "pickle",
                                         "events",
                                         "interaction",
                                         "sender",
                                         "time",
                                         "email",
                                         "re",
                                         "os",
                                         "thread",
                                         "email",
                                         "smtplib"],
                              "compressed": 1,
                              "optimize": 2,
                              "bundle_files": 1
                              } 
        },
    windows=[{"script":"GorumaEmail.py",
                  "icon_resources":[(1,"icons/10_16.ico")]
                }]
    )
nicht wundern über interaction, sender und events - die hab ich selbst erstellt, sie liegen im gleichen Ordner wie die Datei GorumaEmail.py die ich 'freezen' möchte

bekomme aber diese Fehlermeldung
*** searching for required modules ***
Traceback (most recent call last):
File "C:\Dokumente und Einstellungen\Frank Zeche\Desktop\try\setup.py", line 2
2, in <module>
windows=[{"script":"GorumaEmail.py"}]
File "C:\Python25\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\Python25\lib\distutils\dist.py", line 974, in run_commands
self.run_command(cmd)
File "C:\Python25\lib\distutils\dist.py", line 994, in run_command
cmd_obj.run()
File "C:\Python25\Lib\site-packages\py2exe\build_exe.py", line 223, in run
self._run()
File "C:\Python25\Lib\site-packages\py2exe\build_exe.py", line 274, in _run
self.find_needed_modules(mf, required_files, required_modules)
File "C:\Python25\Lib\site-packages\py2exe\build_exe.py", line 1225, in find_n
eeded_modules
os.path.walk(path, visit, packages)
File "C:\Python25\lib\ntpath.py", line 325, in walk
names = os.listdir(top)
TypeError: coercing to Unicode: need string or buffer, NoneType found
Habe gedacht das hat was mit dem Icon zu tun und habe es mal ohne probiert, gleiche Fehlermeldung.

Edit (Leonidas): Code in Python-Tags gesetzt.
kostenlose TS2-Server für jeweils 31 Tage:
http://www.ts-onlyfree.de
Mad-Marty
User
Beiträge: 317
Registriert: Mittwoch 18. Januar 2006, 19:46

Entscheide dich doch erstmal zwischen py2exe und pyinstaller.

Bei PyInstaller musst du import hooks anlegen - siehe das howto was beiliegt.

Bei Py2exe, gibt es auch eine Dokumentation.

Hier ein Beispiel, beachte die includes und excludes, du müsstest eben
email.MimeMultipart benutzen:

Code: Alles auswählen

setup(
    options = {"py2exe": {
                          "compressed": 1,
                          "optimize"  : 2,
                          "excludes"  : ["psyco", "Tkinter"],
                          "includes"  : ["sched", "email", "email.MIMEText",
                                         "Queue", 'new', 'platform',
                                         'cookielib', 'SimpleXMLRPCServer', 
                                         'urllib2', 'datetime', 'zipfile',
                                         'ftplib', 'csv', 'htmllib', 'platform',
                                         'random', 'pprint', 'traceback']
[...]
Frank aka Ch3ck3r
User
Beiträge: 49
Registriert: Dienstag 13. November 2007, 21:56
Wohnort: Berlin
Kontaktdaten:

habe es geschafft, danke.

Allerdings habe ich noch eine Frage.

Bei wxPython habe ich die Buttons im jeweiligen Stil des Betriebsystems.
Bei Windows XP also weiße Buttons mit "runden ecken" und blauem Rand.

Sowie das ganze gefreezt ist (mit py2exe) ist aber alles im Windows 95 Stil.
(Graue in Grau, Eckig, kein Rand sondern "SUNKEN"). Lässt sich da was ändern, bzw. Ist PyInstaller da besser (hab mit pyinstaller das noch nicht gemacht)
kostenlose TS2-Server für jeweils 31 Tage:
http://www.ts-onlyfree.de
Leonidas
Python-Forum Veteran
Beiträge: 16025
Registriert: Freitag 20. Juni 2003, 16:30
Kontaktdaten:

Frank aka Ch3ck3r hat geschrieben:Sowie das ganze gefreezt ist (mit py2exe) ist aber alles im Windows 95 Stil.
(Graue in Grau, Eckig, kein Rand sondern "SUNKEN"). Lässt sich da was ändern,
Ja, das Stichwort sind Manifest-Dateien. Eine Internetsuche nach dem Stichwort kann wunder wirken. Und zum Verständnis der Windows-Theme-Engine führen :)
My god, it's full of CARs! | Leonidasvoice vs (former) Modvoice
Frank aka Ch3ck3r
User
Beiträge: 49
Registriert: Dienstag 13. November 2007, 21:56
Wohnort: Berlin
Kontaktdaten:

danke, hab dazu einiges gefunden, funktioniert einwandfrei nun.
kostenlose TS2-Server für jeweils 31 Tage:
http://www.ts-onlyfree.de
Antworten