0

I'm trying to build an application with py2app using a virtual python environment. I have python 2.7.3. I can build the app fine using python 2.6 (which I have py2app on), but not with my 2.7.3 virtualenv (because I can't install py2app in my 2.7.3 system-wide installation).

This is the error I get:

running py2app
creating /Users/student/Desktop/Coding Projects/MCManager/build/bdist.macosx-10.6-intel/python2.7-standalone/app
creating /Users/student/Desktop/Coding Projects/MCManager/build/bdist.macosx-10.6-intel/python2.7-standalone/app/collect
creating /Users/student/Desktop/Coding Projects/MCManager/build/bdist.macosx-10.6-intel/python2.7-standalone/app/temp
creating build/bdist.macosx-10.6-intel/python2.7-standalone/app/lib-dynload
creating build/bdist.macosx-10.6-intel/python2.7-standalone/app/Frameworks
Traceback (most recent call last):
  File "AppSpec.py", line 21, in <module>
    app = ['ScriptUnix.py']
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Users/student/Desktop/VE/MyVirtEnv/lib/python2.7/site-packages/py2app/build_app.py", line 520, in run
    self._run()
  File "/Users/student/Desktop/VE/MyVirtEnv/lib/python2.7/site-packages/py2app/build_app.py", line 708, in _run
    self.run_normal()
  File "/Users/student/Desktop/VE/MyVirtEnv/lib/python2.7/site-packages/py2app/build_app.py", line 779, in run_normal
    mf = self.get_modulefinder()
  File "/Users/student/Desktop/VE/MyVirtEnv/lib/python2.7/site-packages/py2app/build_app.py", line 658, in get_modulefinder
    debug=debug,
  File "/Users/student/Desktop/VE/MyVirtEnv/lib/python2.7/site-packages/modulegraph/find_modules.py", line 271, in find_modules
    find_needed_modules(mf, scripts, includes, packages)
  File "/Users/student/Desktop/VE/MyVirtEnv/lib/python2.7/site-packages/modulegraph/find_modules.py", line 196, in find_needed_modules
    path = m.packagepath[0]
TypeError: 'NoneType' object has no attribute '__getitem__'

I'm in the directory of the py2app setup file, running it with ~/Desktop/VE/MyVirtEnv/bin/python AppSpec.py py2app. If I run the same thing with python26 AppSpec.py py2app, it works fine.

tkbx
  • 15,602
  • 32
  • 87
  • 122
  • 1
    How did you set up your virtualenv? I am 99% certain you are missing a module available in the system installation. – Benjamin Bannier Dec 11 '12 at 17:54
  • `python virtualenv.py MyVirtEnv`, `pip py2app` – tkbx Dec 11 '12 at 18:06
  • Could it be that `python` and `python26` are different Python versions? You could at least try `python26 virtualenv.py MyVirtEnv`. – Benjamin Bannier Dec 11 '12 at 18:07
  • I don't know if this is the same problem as mine, but I put in a similar ticket when trying to build an app around a non-standard python location (for Maya). [Here is the ticket](https://bitbucket.org/ronaldoussoren/py2app/issue/57/py2app-has-issues-determining-python), though the author isn't inclined to address it because he felt it was either uncommon usage, or not easy to reproduce. – jdi Dec 11 '12 at 18:13
  • @honk They are, `python` and my virtualenv made with `python` are 2.7.3, `python26` is obviously 2.6. py2app is installed on OS X with 2.6 by default, I additionally installed 2.7.3, but can't install py2app on 2.7.3 (long story). That's why I have the virtualenv, I installed py2app in it. The only reason I mentioned `python26` is because I used it to make sure my py2app setup file was made correctly, and that the setup file wasn't the issue. – tkbx Dec 11 '12 at 18:28
  • @jdi "maya" being Linux Mint 13? – tkbx Dec 11 '12 at 18:30
  • @tkbx: You have to find what `m.packagepath[0]` is trying to access. Might be that it needs some package that comes with python2.6, but not with python2.7.3 – Benjamin Bannier Dec 11 '12 at 18:58
  • Maya the 3d app which comes with its own python environment. I was trying to package something on osx around mayas python location. It is a similar situation because it is a custom python location. – jdi Dec 11 '12 at 19:16
  • @honk But you can take a normal 2.7.3 installation and install py2app and run it with no problem. – tkbx Dec 11 '12 at 21:26

0 Answers0