Differences between revisions 4 and 5
Revision 4 as of 2004-04-02 08:21:47
Size: 2526
Editor: 62
Comment: Suggest a patch for modulefinder
Revision 5 as of 2004-04-02 11:55:36
Size: 2170
Editor: 62
Comment: Rename 'solution' into workaround, remove the one that didn't work.
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
= Solution = = Workaround =
Line 33: Line 33:
= Another Solution = = Possible Bugfix =
Line 35: Line 35:
Just another solution is to ''exclude'' the {{{os.path}}} module in the py2exe build process.
This can be done, for example, with the {{{"-e os.path"}}} command line flag.

Or use a py2exe version later than 0.5.0a5, the problem will be fixed there.

-- Thomas Heller

''This is still a problem in py2exe 0.5.0 downloaded on 3/31/04. -- Kent Johnson''

This patch to {{{Lib/modulefinder.py}}} ''should'' fix the problem, it would be nice if someone would try it out, and report back here:
This patch to {{{Lib/modulefinder.py}}} ''should'' fix the problem, it would be nice if people would '''try it out, and report back''' here:

Problem

Using the [http://www.jorendorff.com/articles/python/path/ PathModule] from Jason Jorendorff, modulefinder.py, which is called by Py2Exe, gets into an endless recursion.

It tries to resolve os.path, gets to  os.os.path , further to  os.os.path  and breaks somewhere at os.os.os.os.os.os.os.os.os.os.os.os.os.os.os.os.os.os.os.os.os.os.os.os.os.os.os.path  at which point you get a RuntimeError: maximum recursion depth exceeded.

(Maybe it would be a test to use [http://www.stackless.com/ StackLess] Python, it would run forever or until the maximum string length of pyhton is reached. But maximum string length in Python is only limited by memory, memory is limited by address-space ... )

But apart from joking: it is IMPOSSIBLE to generate an exe with the modern 0.5 Version of Py2Exe when path.py is installed.

Workaround

Just rename

site-packages/path.py

to

site-packages/jpath.py

and make sure also to toggle your imports to

   1 import jpath.py

and to delete path.pyc and path.pyo from your site-packages directory.

20041013HAM

Possible Bugfix

This patch to Lib/modulefinder.py should fix the problem, it would be nice if people would try it out, and report back here:

   1 Index: modulefinder.py
   2 ===================================================================
   3 RCS file: /cvsroot/python/python/dist/src/Lib/modulefinder.py,v
   4 retrieving revision 1.7.6.1
   5 diff -c -r1.7.6.1 modulefinder.py
   6 *** modulefinder.py     14 Nov 2003 10:23:03 -0000      1.7.6.1
   7 --- modulefinder.py     30 Mar 2004 18:54:01 -0000
   8 ***************
   9 *** 245,250 ****
  10 --- 245,253 ----
  11           if self.badmodules.has_key(fqname):
  12               self.msgout(3, "import_module -> None")
  13               return None
  14 +         if parent and parent.__path__ is None:
  15 +             self.msgout(3, "import_module -> None")
  16 +             return None
  17           try:
  18               fp, pathname, stuff = self.find_module(partname,
  19                                                      parent and parent.__path__, parent)

PathModul (last edited 2008-07-08 11:27:43 by localhost)