[gelöst] PyInstaller & co

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
foxx
User
Beiträge: 18
Registriert: Montag 25. September 2006, 22:24
Kontaktdaten:

Hallo,

ich möchte meine Skripte in möglichst wenige Binärdateien packen - am besten nur eine Datei und hab mich dafür ein wenig umgeschaut dabei bin ich bei PyInstaller hängen geblieben:

Py2exe - Windows only
cx_freeze - Funktioniert einfach und gut, aber python selber lässt sich nicht "einpacken" und es werden immer mehrere Dateien
PyInstaller - Unix/Windows, single file möglich, komplettes packen von Python möglich (Keine weiteren Abhängigkeiten)

Nun hab ich gleich nach dem Manual PyInstaller 1.2 (latest stable) installiert und mit "python Makespec.py script.py" eine spec-Datei erstellt (Ich hab erstmal auf das --onefile Feature verzichtet da man bei diesem laut des Manuals mehr beachten muss) und mithilfe von dieser dann das Script mit Abhängigkeiten "kompiliert" (python Build.py specpath/script.spec). Dies schien auch problemlos durchzulaufen und die Binäre Datei wurde auch erstellt zusammen mit den Modulen als .so's
Das Script nutzt pyGTK und hat somit das gleichnamige Modul importiert und ebenfalls den Glade-Support.
gtk, pygtk usw scheint auch als .so Dateien im erstellten Verzeichnis vorzuliegen aber beim starten des Script kommt der Fehler:

Code: Alles auswählen

Traceback (most recent call last):
  File "<string>", line 6, in ?
  File "/pathto/pyinstaller_1.2/iu.py", line 312, in importHook
  File "pathto/pyinstaller_1.2/iu.py", line 398, in doimport
  File "scriptname/buildscriptname/out1.pyz/gtk", line 48, in ?
ImportError: cannot import name _gtk
Wie kann ich nun den "richtigen" import von (py)gtk anordnen? Muss ich den import-Part im Script anpassen? Oder reicht es Änderungen an der spec-Datei vorzunehmen?

PS: In der warn****.txt welche beim Build erstellt wurde ist folgendes zu finden:

Code: Alles auswählen

W: no module named gdk (top-level import by gtk)
W: no module named msvcrt (conditional import by subprocess)
W: no module named ltihooks (top-level import by gtk)
W: no module named ltihooks (top-level import by gobject)
W: no module named _subprocess (conditional import by subprocess)
W: no module named org (top-level import by pickle)
W: no module named org (top-level import by copy)
W: no module named _emx_link (conditional import by os)
W: no module named Carbon (conditional import by tempfile)
W: __all__ is built strangely at line 0 - __future__ (/usr/lib/python2.4/__future__.pyc)
W: delayed  exec statement detected at line 0 - pdb (/usr/lib/python2.4/pdb.pyc)
W: delayed conditional eval hack detected at line 0 - pdb (/usr/lib/python2.4/pdb.pyc)
W: delayed  eval hack detected at line 0 - pdb (/usr/lib/python2.4/pdb.pyc)
W: delayed conditional eval hack detected at line 0 - pdb (/usr/lib/python2.4/pdb.pyc)
W: delayed  eval hack detected at line 0 - pdb (/usr/lib/python2.4/pdb.pyc)
W: delayed  __import__ hack detected at line 0 - gtk._lazyutils (/var/lib/python-support/python2.4/gtk-2.0/gtk/_lazyutils.pyc)
W: delayed conditional __import__ hack detected at line 0 - gtk._lazyutils (/var/lib/python-support/python2.4/gtk-2.0/gtk/_lazyutils.pyc)
W: __all__ is built strangely at line 0 - dis (/usr/lib/python2.4/dis.pyc)
W: delayed  __import__ hack detected at line 0 - encodings (/usr/lib/python2.4/encodings/__init__.pyc)
W: delayed conditional __import__ hack detected at line 0 - gtk.deprecation (/var/lib/python-support/python2.4/gtk-2.0/gtk/deprecation.pyc)
W: __all__ is built strangely at line 0 - re (/usr/lib/python2.4/re.pyc)
W: delayed conditional __import__ hack detected at line 0 - doctest (/usr/lib/python2.4/doctest.pyc)
W: delayed  exec statement detected at line 0 - doctest (/usr/lib/python2.4/doctest.pyc)
W: delayed  eval hack detected at line 0 - os (/usr/lib/python2.4/os.pyc)
W: delayed conditional __import__ hack detected at line 0 - unittest (/usr/lib/python2.4/unittest.pyc)
W: delayed conditional __import__ hack detected at line 0 - unittest (/usr/lib/python2.4/unittest.pyc)
W: __all__ is built strangely at line 0 - tokenize (/usr/lib/python2.4/tokenize.pyc)
W: delayed conditional exec statement detected at line 0 - iu (/pathto/pyinstaller_1.2/iu.pyc)
W: delayed conditional exec statement detected at line 0 - iu (/pathto/pyinstaller_1.2/iu.pyc)
W: delayed  exec statement detected at line 0 - bdb (/usr/lib/python2.4/bdb.pyc)
W: delayed  eval hack detected at line 0 - bdb (/usr/lib/python2.4/bdb.pyc)
W: delayed  eval hack detected at line 0 - bdb (/usr/lib/python2.4/bdb.pyc)
W: delayed  __import__ hack detected at line 0 - pickle (/usr/lib/python2.4/pickle.pyc)
W: delayed  __import__ hack detected at line 0 - pickle (/usr/lib/python2.4/pickle.pyc)
W: delayed conditional eval hack detected at line 0 - warnings (/usr/lib/python2.4/warnings.pyc)
W: delayed conditional __import__ hack detected at line 0 - warnings (/usr/lib/python2.4/warnings.pyc)
Grüße,
foxx
Zuletzt geändert von foxx am Dienstag 2. Januar 2007, 20:23, insgesamt 1-mal geändert.
foxx
User
Beiträge: 18
Registriert: Montag 25. September 2006, 22:24
Kontaktdaten:

Kann mir denn keiner helfen? :cry:
CM
User
Beiträge: 2464
Registriert: Sonntag 29. August 2004, 19:47
Kontaktdaten:

Hi,

finde die Frage auch interessant, aber komme einfach irgendwie nicht dazu mich mal näher mit dem pyinstaller zu beschäftigen. Und irgendwie habe ich den Eindruck, als ob die pyinstaller-Leute hier im Forum nicht so stark vertreten sind.
Wie wäre es Du wendest Dich an die Mailingliste und postet hier bei Gelegenheit die Lösung?

Viel Erfolg,
Christian
foxx
User
Beiträge: 18
Registriert: Montag 25. September 2006, 22:24
Kontaktdaten:

Hi,

ich wusste garnicht das es diese Maillinglist gibt. Ich hab die Frage schon in der Python-DE Google-Group gepostet aber auch da bisher noch keine Antwort erhalten. Ich meld mich einfach mal bei der Maillinglist an und probiers dort :)
foxx
User
Beiträge: 18
Registriert: Montag 25. September 2006, 22:24
Kontaktdaten:

Hab das Problem nun seit einiger Zeit selber gelöst: Im gtk-hook muss noch cairo und pangocairo hinzugefügt werden da dieses von meinem Script benötigt wird.
[url=http://www.php4you.de/]PHP4You[/url]
[url=http://forum.php4you.de]PHP4You-Forum[/url]
[url=http://janek.php4you.de/]Mein Blog[/url]
[url=http://www.php4you.de/against_icq.html]Against ICQ[/url]
Antworten