[Pythonmac-SIG] Python based apps woes on MacOs X (was :Re: [Pythoncard-users] Re: PythonCard on OS X 10.4 with Python 2.4.1)

Alex Tweedly alex at tweedly.net
Sun Sep 4 13:10:08 CEST 2005


Ronald Oussoren wrote:
Thanks Ronald. I hadn't spotted that this was still being cc'ed to 
pythonmac-sig - so extra thanks for that.

>
> I haven't followed this discusion upto now, but do you use py2app to  
> build the application bundle on OSX? py2app places all .py/.pyc files  
> into a zip file, resources are outside of the zip file.
>
No, these problems are also being seen within the IDE, so it's not an 
app/bundle problem.

> BTW. do you know about setuptools? It contains a generic API for  
> dealing with resource files.
>
Yes, and that looks like a promising way to do this in the future. 
(though it increases the dependencies).
But this code has existed and worked for a couple of years now, it's 
important we know what's going wrong with it in case there are other 
(less obvious) things that are going to fail for the same reasons.

>> So - that's the background.
>>
>> Brad sent the debug output from the first case above (before  Kevin's 
>> suggested change), and also reported that the problem  persisted 
>> after the change. So it looks likely that it's a Python  bug. The 
>> Python docs are very sparse on what sys.modules should do.
>
>
> I'd say it is unlikely to be a bug in Python :-)
>
So would I - but the evidence up till this email all pointed that way - 
and since this is (perhaps) an unusual use of the sys.modules info, it 
seems just possible.

>>
>> I'd like to see a simple test output which is independent of  
>> PythonCard.
>>
>> < snip >
>
>
> For what it's worth:
>
> Python 2.3.5 (#1, Mar 20 2005, 20:38:20)
> [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sys
> >>> from mmm import myFile
> >>> myFile.myClass.__module__
> 'mmm.myFile'
> >>> myFile.__file__
> 'mmm/myFile.pyc'
> >>> sys.modules[myFile.myClass.__module__].__file__
> 'mmm/myFile.pyc'
>
> and:
> Python 2.4.1 (#1, Aug 23 2005, 21:38:15)
> [GCC 4.0.0 (Apple Computer, Inc. build 5026)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sys
> >>> from mmm import myFile
> >>> myFile.myClass.__module__
> 'mmm.myFile'
> >>> myFile.__file__
> 'mmm/myFile.py'
> >>> sys.modules[myFile.myClass.__module__].__file__
> 'mmm/myFile.py'
>
Thanks again for that.  (Not quite was I was hoping for :-), but very 
valuable info).

So we now know this simplest case works as expected - and the rather 
complex case within PythonCard doesn't.

It should be straightforward (if somewhat tedious) to narrow down the 
differences until we find where the difference is. But that's not the 
kind of debugging we can do via email on a list (or two!!), so I'm 
hoping a PythonCard / Mac user can take it from there (or will contact 
me off-list and we can work on narrowing it down).

-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/86 - Release Date: 31/08/2005



More information about the Pythonmac-SIG mailing list