开发者

Missing dll's when using Py2Exe, PyGtk, and Glade

开发者 https://www.devze.com 2023-02-18 21:29 出处:网络
I\'m trying to build my first application using Py2Exe and I\'m following the instructions listed at http://www.py2exe.org/index.cgi/Py2exeAndPyGTK, with the exception that I\'m creating the UI with G

I'm trying to build my first application using Py2Exe and I'm following the instructions listed at http://www.py2exe.org/index.cgi/Py2exeAndPyGTK, with the exception that I'm creating the UI with Glade. (Its just a very minimal gui with a close button and a label.)

When I try to run the resulting exe, I get an error dialog asking me to check the log file which contains the following error message:

Traceback (most recent call last):
  File "pygtkpy2exetest.py", line 8, in <module>
  File "gtk\glade.pyc", line 12, in <module>
  File "gtk\glade.pyc", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.

So I started digging around a bit, the first thing that I noticed is that it looks like py2exe is not able to find glib modules:

The following modules appear to be missing
['gdk', 'unix', 'glib.GError', 'glib.IOChannel', 'glib.IO_ERR', 'glib.IO_FLAG_APPEND', 'glib.IO_FLAG_GET_MASK', 'glib.IO_FLAG_IS_READABLE', 'glib.IO_FLAG_IS_SEEKABLE', 'glib.IO_FLAG_IS_WRITEABLE', 'glib.IO_FLAG_MASK', 'glib.IO_FLAG_NONBLOCK', 'glib.IO_FLAG_SET_MASK', 'glib.IO_HUP', 'glib.IO_IN', 开发者_如何学C'glib.IO_NVAL', 'glib.IO_OUT', 'glib.IO_PRI', 'glib.IO_STATUS_AGAIN', 'glib.IO_STATUS_EOF', 'glib.IO_STATUS_ERROR', 'glib.IO_STATUS_NORMAL', 'glib.Idle', 'glib.MainContext', 'glib.MainLoop', 'glib.OPTION_ERROR', 'glib.OPTION_ERROR_BAD_VALUE', 'glib.OPTION_ERROR_FAILED', 'glib.OPTION_ERROR_UNKNOWN_OPTION', 'glib.OPTION_FLAG_FILENAME', 'glib.OPTION_FLAG_HIDDEN', 'glib.OPTION_FLAG_IN_MAIN', 'glib.OPTION_FLAG_NOALIAS', 'glib.OPTION_FLAG_NO_ARG', 'glib.OPTION_FLAG_OPTIONAL_ARG', 'glib.OPTION_FLAG_REVERSE', 'glib.OPTION_REMAINING', 'glib.OptionContext', 'glib.OptionGroup', 'glib.PRIORITY_DEFAULT', 'glib.PRIORITY_DEFAULT_IDLE', 'glib.PRIORITY_HIGH', 'glib.PRIORITY_HIGH_IDLE', 'glib.PRIORITY_LOW', 'glib.Pid', 'glib.PollFD', 'glib.SPAWN_CHILD_INHERITS_STDIN', 'glib.SPAWN_DO_NOT_REAP_CHILD', 'glib.SPAWN_FILE_AND_ARGV_ZERO', 'glib.SPAWN_LEAVE_DESCRIPTORS_OPEN', 'glib.SPAWN_SEARCH_PATH', 'glib.SPAWN_STDERR_TO_DEV_NULL', 'glib.SPAWN_STDOUT_TO_DEV_NULL', 'glib.Source', 'glib.Timeout', 'glib.child_watch_add', 'glib.filename_display_basename', 'glib.filename_display_name', 'glib.filename_from_utf8', 'glib.get_application_name', 'glib.get_current_time', 'glib.get_prgname', 'glib.glib_version', 'glib.idle_add', 'glib.io_add_watch', 'glib.main_context_default', 'glib.main_depth', 'glib.markup_escape_text', 'glib.set_application_name', 'glib.set_prgname', 'glib.source_remove', 'glib.spawn_async', 'glib.timeout_add', 'glib.timeout_add_seconds', 'glib.uri_list_extract_uris']

If I try to manually add the glib module to the "includes" option in setyp.py it doesn't have any effect.

Digging further, I opened up the resulting exe with Dependency Walker, it shows me that there are two dll's missing, MPR.DLL and SHLWAPI.DLL, but both of these are in my system32 folder.

If I just create the UI without glade, I have no problems what so ever, but given that I've already created another application with glade, I'd like to stick with glade if possible. Any suggestions on where to go from here? I'm using Python 2.7, Py2Exe 0.6.9, PyGtk 2.22.6 on Windows XP.

Thanks, Brent


i'm also having the same problem, however after spending few hours in google, i manage to find the solution.

  1. use dependencywalker and profiling ur xxx.exe u can download from http://www.dependencywalker.com/
  2. find out the error file (for my case, they are MSJAVA.DLL and libxml2-2.dll)
  3. search ur pc directory and copy them into 'dist' folder. u also can download the missing DLL from other website.
  4. run the dependencywalker again, u will see the error reduce or become no more.
  5. xxx.exe is executable now.

I hope above would helps those who are facing such kind of problem.

Neoh !!!share is care!!!


This may not help, but I had the same issue & it turned out to be a gtk installation issue. This caused problems with the gtk._gtk.pyd file which py2exe produced.

The setup.py I used was pretty much the same as that which py2exe suggests on http://www.py2exe.org/index.cgi/Py2exeAndPyGTK


I had the same error once and fix it. when you run the setup.py py2exe your files are created in win32. pyo as glade.pyo, and when you do you believe in win64 .pyc, at least that's what I experience, which ran the py2exe my app in window7-64 and then gave me the error, but when you create the executable on win32 I did, I think the glade.pyo, then gave me the same error, go to my project and do everithing with

gtk.Builder()

` not use more

gtk.glade.XML("file.glade")

and remove the import gtk.glade of my .py files and my setup.py just use

import gtk

and everything worked perfectly. I hope my experiences will be of your help.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号