[Pythonmac-SIG] Building plugins with py2app

Ronald Oussoren ronaldoussoren at mac.com
Thu Oct 12 23:56:45 CEST 2006


On Oct 12, 2006, at 11:40 PM, Dethe Elza wrote:

> On 12-Oct-06, at 2:15 PM, Ronald Oussoren wrote:
>
>> What are you using to test? I've tested with the SillyBalls  
>> screensaver in PyObjC's examples directory (Examples/Plugins/ 
>> SillyBallsSaver).
>
> I've been testing with my screensaver, Pastels, but I just tried  
> with SillyBalls and it also failed to load.
>
>> I'm also using the SVN HEAD for altgraph, modulegraph and the  
>> other related projects, I don't know if that helps.
>
>> If upgrading doesn't help, or the SillyBallsSaver example doesn't  
>> work for you, I'd like to know loads of version information  
>> (Python, PyObjC, py2app, altgraph, modulegraph, macholib) and the  
>> exact error message you get in Console.app (close  
>> SystemPreferences, open Console.app, use the Clear button, then  
>> open a freshly build version of your saver or the SillyBals saver).
>
> macholib 1.1
> modulegraph 0.7
> altgraph 0.6.7
> bdist_mpkg 0.4.2

I have macholib 1.2, modulegraph 0.7.1, altgraph 0.6.8 and py2app  
0.3.5, all fresh checkouts from svn.

>
> Any others?
>
> Console output from opening SillyBalls:
>
> 'import site' failed; use -v for traceback
> Traceback (most recent call last):
>   File "/Users/delza/Library/Screen Savers/SillyBalls.saver/ 
> Contents/Resources/__boot__.py", line 7, in ?
>     _disable_linecache()
>   File "/Users/delza/Library/Screen Savers/SillyBalls.saver/ 
> Contents/Resources/__boot__.py", line 2, in _disable_linecache
>     import linecache
> ImportError: No module named linecache
> 2006-10-12 14:37:36.350 System Preferences[839] SillyBalls has  
> encountered a fatal error, and will now terminate.
> 2006-10-12 14:37:36.350 System Preferences[839] An uncaught  
> exception was raised during execution of the main script:
>
> ImportError: No module named linecache

Could you check the Info.plist and the structure of the screensaver?

Info.plist should have a key PyResourcePackages with an empty array  
as its value and an PyRuntimeLocations that points to an embedded  
python framework. The patch I just checked in ensures that  
PyResourcePackages is empty, with an unpatched version the array will  
contain some strings and that messes up sys.path.

There should be a lib/python2.4 in the Resources directory of the  
screensaver, that should contain site-packages.zip, site.py and a lib- 
dynload directory.

To make absolutely sure you have my patched version you could check  
py2app/bundletemplate/plist_template.py, there is a definition of  
PyResourcePackages in there, the value of which should be an empty  
list. One way to check:

.>> import pprint
.>> import py2app.bundletemplate.plist_template
.>> pprint.pprint(py2app.bundletemplate.plist_template.infoPlistDict 
('dummy'))
{'CFBundleDevelopmentRegion': u'English',
'CFBundleDisplayName': u'dummy',
'CFBundleExecutable': u'dummy',
'CFBundleIconFile': u'dummy',
'CFBundleIdentifier': u'org.pythonmac.unspecified.dummy',
'CFBundleInfoDictionaryVersion': u'6.0',
'CFBundleName': u'dummy',
'CFBundlePackageType': u'BNDL',
'CFBundleShortVersionString': u'0.0',
'CFBundleSignature': u'????',
'CFBundleVersion': u'0.0',
'LSHasLocalizedDisplayName': False,
'NSAppleScriptEnabled': False,
'NSHumanReadableCopyright': u'Copyright not specified',
'NSMainNibFile': u'MainMenu',
'NSPrincipalClass': u'dummy',
'PyMainFileNames': [u'__boot__'],
'PyResourcePackages': [],
'PyRuntimeLocations': [u'@executable_path/../Frameworks/ 
Python.framework/Versions/2.4/Python',
                         u'~/Library/Frameworks/Python.framework/ 
Versions/2.4/Python',
                         u'/Library/Frameworks/Python.framework/ 
Versions/2.4/Python',
                         u'/Network/Library/Frameworks/ 
Python.framework/Versions/2.4/Python',
                         u'/System/Library/Frameworks/ 
Python.framework/Versions/2.4/Python'],
u'PythonInfoDict': {'PythonExecutable': u'/Library/Frameworks/ 
Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/ 
Python',
                      'PythonLongVersion': u'2.4.4c1 (#1, Oct 11  
2006, 15:11:04) \n[GCC 4.0.1 (Apple Computer, Inc. build 5341)]',
                      'PythonShortVersion': u'2.4',
                      u'py2app': {'version': u'0.3.5', 'template':  
u'bundle'}}}



Ronald

P.S. Are you sure you installed the latest version of py2app in the  
right version of Python? If you installed python2.5 after installing  
python2.4 easy_install might point to the 2.5 version of easy_install  
(if you have that installed), if it is easy_install-2.4 should pick  
up the correct version.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3562 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20061012/060e2a59/attachment.bin 


More information about the Pythonmac-SIG mailing list