[Pythonmac-SIG] py2app error

Nathan Lemoine lemoine.nathan at gmail.com
Sat Jul 31 23:02:41 CEST 2010


Running the testing application in the command line did confirm that  
the pyglet module isn't being found:

   File "/Users/Nate/dist/tester.app/Contents/Resources/__boot__.py",  
line 160, in _run
     execfile(path, globals(), globals())
   File "/Users/Nate/Desktop/tester.py", line 1, in <module>
     import pyglet
ImportError: No module named pyglet

Is there a way to manually add the path for pyglet to py2app's search  
or in the setup.py file to force the module to be loaded?

On Jul 30, 2010, at 1:54 AM, Ronald Oussoren wrote:

>
> On 30 Jul, 2010, at 2:59, Nathan Lemoine wrote:
>
>> I installed the 0.5.2 update, and I've tried making just a very  
>> simple pyglet app to play a movie file so that you all could try it  
>> if you want on your python distributions:
>>
>> import pyglet
>>
>> vidPath="video.avi" ##put the path to a video file here
>> window = pyglet.window.Window()
>> source = pyglet.media.StreamingSource()
>> MediaLoad = pyglet.media.load(vidPath)
>> player = pyglet.media.Player()
>> player.queue(MediaLoad)
>> player.play()
>>
>> @window.event
>> def on_draw():
>> 	player.get_texture().blit(0,0)
>>
>> pyglet.app.run()
>
> Thanks for the demo, that will definitly help in reproducing and  
> fixing the problem.
>
>>
>> Executing python setup.py py2app still gives me the same error:
>>
>> Traceback (most recent call last):
>> File "/Library/Python/2.5/site-packages/py2app-0.5.2-py2.5.egg/ 
>> py2app/build_app.py", line 604, in _run
>>   self.run_normal()
>> File "/Library/Python/2.5/site-packages/py2app-0.5.2-py2.5.egg/ 
>> py2app/build_app.py", line 675, in run_normal
>>   self.create_binaries(py_files, pkgdirs, extensions, loader_files)
>> File "/Library/Python/2.5/site-packages/py2app-0.5.2-py2.5.egg/ 
>> py2app/build_app.py", line 739, in create_binaries
>>   dry_run=self.dry_run)
>> File "/Library/Python/2.5/site-packages/py2app-0.5.2-py2.5.egg/ 
>> py2app/util.py", line 376, in byte_compile
>>   if force or newer(mod.filename, cfile):
>> File "/Library/Python/2.5/site-packages/py2app-0.5.2-py2.5.egg/ 
>> py2app/util.py", line 172, in newer
>>   msource = get_mtime(source)
>> File "/Library/Python/2.5/site-packages/py2app-0.5.2-py2.5.egg/ 
>> py2app/util.py", line 164, in get_mtime
>>   info = zf.getinfo(rest)
>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
>> python2.5/zipfile.py", line 462, in getinfo
>>   return self.NameToInfo[name]
>> KeyError: 'pyglet/__init__.pyc'
>>> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
>>> python2.5/zipfile.py(462)getinfo()
>> -> return self.NameToInfo[name]
>> (Pdb)
>>
>> I ran it in alias mode as well and it bundled 'tester.app'  
>> successfully. When I attempted to run the bundle, I just got a  
>> dialog box that said 'tester Error' and brought me to the MacPython  
>> website. I'm not sure how to find out what the issue is with the  
>> aliased bundle.
>
> You can run the app from the command-line:  test.app/Contents/MacOS/ 
> tester
>
> When you do that you'll get error messages in your terminal window,  
> and those should explain what's going on.  I expect that pyglet  
> cannot be found.
>
>>
>> Thanks for the help so far! I really appreciate it. I don't think I  
>> could figure this out on my own
>
> I haven't had time to look into this issue specifically, I'll do so  
> in the near future.
>
> Ronald
>
>
>>
>>
>>
>> On Jul 29, 2010, at 2:34 AM, Ronald Oussoren wrote:
>>
>>>
>>> On 29 Jul, 2010, at 8:09, Ronald Oussoren wrote:
>>>
>>>>
>>>> On 28 Jul, 2010, at 18:38, Nathan Lemoine wrote:
>>>>
>>>>>
>>>>> Traceback (most recent call last):
>>>>> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/ 
>>>>> py2app/build_app.py", line 602, in _run
>>>>> self.run_alias()
>>>>> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/ 
>>>>> py2app/build_app.py", line 548, in run_alias
>>>>> dst = self.build_alias_executable(target, target.script)
>>>>> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/ 
>>>>> py2app/build_app.py", line 1145, in build_alias_executable
>>>>> appdir, resdir, plist = self.create_bundle(target, script)
>>>>> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/ 
>>>>> py2app/build_app.py", line 1131, in create_bundle
>>>>> use_runtime_preference=use_runtime_preference
>>>>> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/ 
>>>>> py2app/build_app.py", line 1120, in create_appbundle
>>>>> extension=self.extension,
>>>>> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/ 
>>>>> py2app/create_appbundle.py", line 34, in create_appbundle
>>>>> copy(srcmain, destmain)
>>>>> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/ 
>>>>> py2app/util.py", line 233, in mergecopy
>>>>> return macholib.util.mergecopy(src, dest)
>>>>> File "build/bdist.macosx-10.5-i386/egg/macholib/util.py", line  
>>>>> 111, in mergecopy
>>>>> copy2(src, dest)
>>>>> File "build/bdist.macosx-10.5-i386/egg/macholib/util.py", line  
>>>>> 43, in copy2
>>>>> shutil.copy2(fsencoding(src), fsencoding(dst))
>>>>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ 
>>>>> lib/python2.5/shutil.py", line 91, in copy2
>>>>> copyfile(src, dst)
>>>>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ 
>>>>> lib/python2.5/shutil.py", line 46, in copyfile
>>>>> fsrc = open(src, 'rb')
>>>>> IOError: [Errno 2] No such file or directory: '/Library/Python/ 
>>>>> 2.5/site-packages/py2app-0.5-py2.5.egg/py2app/apptemplate/ 
>>>>> prebuilt/main-i386'
>>>>>> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
>>>>>> python2.5/shutil.py(53)copyfile()
>>>>> -> fsrc.close()
>>>>>
>>>>> I went into the Python Framework folder and the only prebuilt  
>>>>> executeable in there is 32bit one, there isn't a main-i386 file.  
>>>>> Am I missing a file?
>>>>
>>>> You aren't missing a file, py2app doesn't have a main-i386 file.   
>>>> As a quick workaround you can copy /Library/Python/2.5/site- 
>>>> packages/py2app-0.5-py2.5.egg/py2app/apptemplate/prebuilt/main- 
>>>> fat  to /Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/ 
>>>> py2app/apptemplate/prebuilt/main-i386.
>>>>
>>>> I will tweak py2app to better handle this, that will be in the  
>>>> next release (0.5.2, hopefully later this week).
>>>
>>> I've upload py2app 0.5.2. With this version I can build a pyobjc  
>>> application using python 2.5 (without the IOError exception), the  
>>> pyglet error is not yet fixed.
>>>
>>> Ronald
>>>
>>
>



More information about the Pythonmac-SIG mailing list