On Thu, 2003-09-04 at 16:27, Charles Lepple wrote:
> Cedric Gustin said:
> > At 06:17 PM 9/3/2003 -0400, Charles Lepple wrote:
> [...]
> >>AssertionError: required version '2.0' not found on system
> >>
> >>... which is probably a result of calling pygtk.require('2.0').
> >
> > Right, py2exe does not like it, as your final executable does not know
> > what sys.path and sys.modules contain.
> 
> So pygtk.require() is more to ensure that the version of pygtk is 2.0
> (well, 1.99.x, I guess) than to select GTK+ 2?

Yes. pygtk.require calls pygtk._get_available_versions() internally
which returns something like (on linux)
{'2.0': '/usr/lib/python2.2/site-packages/gtk-2.0'}. I suppose your
pyexed executable gets an empty list least and thus fails miserably. 

> 
> > Just get rid of it and it should work. At least py2exe works for me on the
> > glade example (glade-demo.py). Just make sure that py2exe does not include
> > the GTK+ DLLs (except libglade-2.0.dll and libxml2.dll) and ask your final
> > users to install the dropline GTK+ distribution instead.
> 
> This is where it gets a little fuzzy. When you say "make sure it does not
> include the DLLs", should I use '--excludes=' on the command line, or
> should I do this manually? (Jamey Cribbs' post, which suggests an
> alternate method-- namely, incorporating all of the GTK+ libraries and
> data files into the dist directory-- made me wonder if I'm doing this part
> correctly.)

py2exe adds the gtk+, pango, atk, ... DLLS to your executable target
directory but does not copy the accompanying files (among others those
under etc/pango). The way those files are located at runtime is done by
extracting the GTK+ Runtime installation directory from the place where
the GTK+ DLLs are found when you run your executable. Say your program
is located in C:\Program Files\Foo. The GTK+ runtime will look in
C:\Program Files\Foo\etc\pango for pango.modules and pango.alias, and
will fail... 

That's why I recommend to manually delete the GTK+ DLLs from your py2exe
distribution directory (except the libglade and libxml2 DLLs) and always
rely on the dropline distribution for the GTK+ runtime. This way, you
will also avoid DLL dependency hell. 

> 
> I import this in setup.py so that py2exe can find the DLLs when importing
> pygtk. py2exe won't this value of PATH in my final executable, will it?
> Also, is setup.py where I should import modules such as pango and atk
> (considering that I don't reference them directly anywhere else)?

Just make sure the pango and atk pyd file are included by py2exe (using
a setup.cfg).

Cedric

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to