[Pythonmac-SIG] weird #! problem

Russell E Owen owen at astro.washington.edu
Fri Feb 20 16:30:01 EST 2004


I do have two pythons, but only one is a framework python (the 
standard Panther install). The other is a vanilla unix-X11 python in 
the usual /usr/local/bin location.

Still, it looks as if that may be the problem. I temporarily modified 
my PATH so /usr/local/bin was no longer on it, and that fixed the 
build problem. Weird. I wonder how the framework python had a clue 
that the other one existed? This is the first time I've seen any 
evidence of "crosstalk".

-- Russell


At 4:09 PM -0500 2004-02-20, Bob Ippolito wrote:
>Everything in MacPython 2.3 is *EXTREMELY* fragile if you have 
>multiple copies of Python installed in the default places.  I bet if 
>you move your copy out of /Library/Frameworks, then everything would 
>work fine.  Also, the argv[0] is different (from C.. not Python) 
>when you run "/usr/bin/python blah.py" vs "./blah.py", which can 
>cause problems with some OS X facilities that talk to WindowServer 
>(though bundlebuilder shouldn't have any).
>
>I can't even begin to guess at which little thing is causing your 
>problem without examining the two resultant app bundles, but there 
>are a lot of possible little things that can go wrong and cause such 
>errors.
>
>I'm not masochistic enough to try and deal with two mutually 
>exclusive framework Pythons at the same time, and I suggest you do 
>the same.
>
>-bob
>
>On Feb 20, 2004, at 3:47 PM, Russell E. Owen wrote:
>
>>I am trying to make an easy-to-use build script and have stumbled across
>>a very strange thing. Here is a minimal version of the script:
>>
>>script buildtui.py:
>>#!/usr/bin/python
>>import sys, bundlebuilder
>>if len(sys.argv) == 1:
>>     sys.argv.append('build')
>>bundlebuilder.buildapp(....)
>>
>>What I observe is if I run this script this way:
>>% /usr/bin/python buildtui.py
>>it works just fine. But if I run it this way:
>>./buildtui.py
>>it fails. It *appears* to work (the output looks the same, and from
>>poking around in the bundle the resulting app looks the same, but the
>>resulting app fails with the following message in the Console:
>>
>>Fatal Python error: Interpreter not initialized (version mismatch?)
>>
>>I can't imagine how my build script can even tell the difference between
>>the two means of execution. But I've confirmed this multiple times with
>>variant scripts.
>>
>>Any idea what may be happening and what to do about it?
>>
>>I hope I'm not overlooking something really obvious, but I've put
>>diagnostic printout in the script and I just can't see anything going on
>>that is different. One thing I've not done is a byte-by-byte comparison
>>of the two resulting applications.
>>
>>-- Russell
>>
>>
>>_______________________________________________
>>Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
>>http://mail.python.org/mailman/listinfo/pythonmac-sig




More information about the Pythonmac-SIG mailing list