Friday 15 July 2011

python - Cannot Include gi.repository.Gtk in py2exe -



python - Cannot Include gi.repository.Gtk in py2exe -

i have project in python 3.4 , gtk+ 3. i'm on windows xp sp3 32-bit (virtualbox).

i need compile downwards executable using py2exe. (do not suggest cx_freeze. has 10 times problems on project py2exe).

my setup.py follows.

#!/usr/bin/python setuptools import setup import py2exe setup(name="redstring", version="2.0", description="redundant string generator", author="mousepaw labs", url="http://www.mousepawgames.com/", maintainer_email="info@mousepawgames.com", data_files=[("", ["redstring.png", "redstring_interface.glade"])], py_modules=["redstring"], windows=[{'script':'redstring.py'}], options={"py2exe":{ "unbuffered": true, "compressed":true, "bundle_files": 1, 'packages':['gi.repository'], }}, zipfile=none )

when run via c:\documents , settings\jason\desktop\redstring2>python setup.py py2exe, next output (in full).

running py2exe running build_py 1 missing modules ------------------ ? gi.repository.gtk imported __script__ building 'dist\redstring.exe'. c:\documents , settings\jason\desktop\redstring2>

the actual script, redstring.py, runs without hitch in windows environment. in that, have next (working) line of code: from gi.repository import gtk import gi.repository in entire project.

if swap line in setup.py 'packages':['gi'],, error output switches 24-some-odd missing modules, of them belonging gi.repository. if seek , import "gtk" or "gi.repository.gtk" in either 'packages': or 'includes':, error file in question beingness imported cannot found.

i spent 8 hours on #python (irc channel) today, , no 1 solve this. need packaged downwards windows binary week.

note: this question not duplicate; while similar issue, a) not same error message, , b) neither reply solves question in way.

i solved by, first of all, downgrading python 2.7. (gtk+ 3.8 still fine.) py2exe apparently has known issues python 3.

second, switched...

options={"py2exe": { "bundle_files": 1, }

to

options={"py2exe": { "bundle_files": 3, }

for reason, py2exe cannot include files needed run gi library when 'bundle_files' set 1 or 2.

the total setup.py works py2exe project can found on github. run on cmd python setup.py py2exe.

python python-3.x py2exe pygobject

No comments:

Post a Comment