Missing dll when using Py2Exe, PyGtk and Glade

I am trying to build my first application using Py2Exe, and I follow the instructions listed at http://www.py2exe.org/index.cgi/Py2exeAndPyGTK , except that I am creating a user interface using Glade. (Its just a very minimal gui with a closed button and shortcut.)

When I try to run the resulting exe, I get a dialog box with an error message asking me to check the log file containing 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 I noticed was that it looks like py2exe cannot find the 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', '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, this has no effect.

Digging further, I opened the resulting exe using Dependency Walker, it shows me that there are no two DLLs, MPR.DLL and SHLWAPI.DLL, but both of them are in my system32 folder.

If I just create a user interface without a clearing, I have no problem, whatever that may be, but given that I have already created another application with a clearing, I would like to stick to the clearing if possible. Any suggestions on where to go from here? I am using Python 2.7, Py2Exe 0.6.9, PyGtk 2.22.6 on Windows XP.

Thanks Brent

+4
source share
3 answers

I have the same problem too, however, after spending several hours on google, I manage to find a solution.

  • Use the dependent variable and profile ur xxx.exe u can be downloaded from http://www.dependencywalker.com/
  • find the error file (for my case it is MSJAVA.DLL and libxml2-2.dll)
  • find the ur pc directory and copy them to the "dist" folder. u can also download the missing DLL from another site.
  • run dependencywalker again, u will see that the error will decrease or no longer.
  • xxx.exe is now running.

I hope the above will help those who are faced with such a problem.

Neoh !!! share is a concern !!!

+5
source

This may not help, but I had the same problem and it turned out to be a problem installing gtk. This caused problems with the gtk._gtk.pyd file created by py2exe.

The setup.py parameter used was almost the same as the one offered by py2exe at http://www.py2exe.org/index.cgi/Py2exeAndPyGTK

+1
source

I had the same error and fixed it. when running setup.py py2exe your files are created in win32 . pyo like glade.py o, and when you believe in win64 .pyc , at least what I experience is that I ran py2exe my app in window7-64 and then gave me an error, but when you create an executable on win32 I made, I think, glade.pyo , and then gave me the same error, go to my project and do it endlessly with

gtk.Builder ()

`no longer use

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

and delete the imported gtk.glade my .py files and setup.py just use

import gtk

and it worked perfectly. I hope my experience will be useful to you.

0
source

Source: https://habr.com/ru/post/1344845/


All Articles