Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#42 Path incorrectly set for projects with package_dir (0.5.0)

closed-fixed
nobody
None
5
2004-06-01
2004-03-07
Nick Mathewson
No

I'm not sure I've diagnosed this correctly; I hope you
can help.

My project has all of its python files under ./lib, and
uses distutils's 'package_dir' setting to find them
there. But starting with version 0.5.0, py2exe no
longer finds them there. If I manually add "./lib" to
the path, everything works again.

I'm attaching a minimal test case to demonstrate the
problem. When I run "python setup.py py2exe", it says

The following modules appear to be missing
['z']

But when I uncomment the commented-out line in setup.py
('sys.path.append("./lib")'), py2exe works fine again.

I am using Python 2.3.2 on Windows 2000. I did not
have this problem with older versions of py2exe.

Discussion

  • Nick Mathewson
    Nick Mathewson
    2004-03-07

    Minimal failing case (zipped)

     
    Attachments
  • Thomas Heller
    Thomas Heller
    2004-04-07

    Logged In: YES
    user_id=11105

    My typical usage of py2exe has changed, I now always use
    separate setup scripts for building and installing my
    extension(s), and for building my exe-files - the setup
    scripts get too complicated.

    Does this make sense to you?

     
  • Logged In: NO

    Hm. I understand what you're saying, but I'm not clear what
    it implies for this bug. Are you saying that
    install-then-run-py2exe is the only official process, and
    other usage modes for py2exe are now unsupported? Or are
    you only suggesting a workaround?

    Personally, I prefer not to install first: if there is a
    problem in the code I'm trying to package, I would prefer
    not to replace any older copies in site-packages. But of
    course, if my use is unsupported, I could probably solve my
    needs by using a separate python installation for running
    py2exe.

     
  • Thomas Heller
    Thomas Heller
    2004-04-28

    Logged In: YES
    user_id=11105

    I would like to add this code to py2exe, IMO it should fix
    your problem. At the very beginning of the run() method of
    py2exe/build_exe.py file, please add these lines:

    ........build = self.reinitialize_command('build')
    ........build.run()
    ........sys.path[:0] = [build.build_lib, build.build_platlib]

    Can you please try it out?

     
  • Nick Mathewson
    Nick Mathewson
    2004-05-10

    Logged In: YES
    user_id=499

    Sorry about the delay: I tried your patch, and it seemed to
    solve the problem. Thanks!

     
  • Thomas Heller
    Thomas Heller
    2004-06-01

    • status: open --> closed-fixed