[Pythonmac-SIG] Python bindings for DB XML

Bob Ippolito bob at redivi.com
Mon Jan 26 12:42:55 EST 2004


On Jan 26, 2004, at 12:17 PM, Chris Barker wrote:

> Matt Patterson wrote:
>>   and thought that my path was correctly ordered. When
>> I checked this by looking at the version of Python I still thought 
>> that 10.3 shipped with Python 2.2, and I saw 2.3 and thought that I 
>> was running my /usr/local/bin python 2.3.3...
>> I don't imagine I'll have any problems now that's resolved...
>
> We need to start a little eduction campain here. I've seen advice 
> given here that getting your PATH in the right order is the way to 
> deal with multiple versions of python. That's really a Bad Idea for a 
> number of reasons:
>
> - While for the moment, for Python's sake, you may want to have 
> /usr/local/bin searched before /usr/bin, it may be that for other 
> applications, you'd want it the other way around.
>
> - When you install the third version of Python, what are you going to 
> do then?
>
> - what if Apple has tools that put "#!/usr/bin/env python" at the top, 
> and expect to find the python in /usr/bin. I know, they shouldn't do 
> that , but RedHat did it for years, and I think they still do.
>
> -- There are various ways that the PATH can get set, they might not 
> all be the same.
>
> -- The solution I propose is that you put:
>
>    #!/usr/bin/env pythonX.X
>
> At the top of your file. Where X.X is the version of Python you want 
> (python2.2, python2.3, etc.) This way that script will always give you 
> the Python that it was written and tested with, and you can have any 
> number of pythons on your PATH without having to define a "default" 
> one. I've been doing this on LInux for years, and it works great. As a 
> bonus, if you distribute your scripts (or even look at your own in a 
> year or two), it's very clear what version they were developed on.
>
> I know Jack said that PythonLauncher would respect the #! line, so 
> this should work for scripts launched from either the finder or a 
> command line. I've only used a command line at the moment...does this 
> work?
>
> As a community, we really need to make sure that there is a way to 
> have multiple versions of python coexisting peacefully. The #! line is 
> one good way to do it. Frankly, I have no idea how to make this work 
> on Windows, but that's not this group's problem!
>
> By the way, what does BuildApplet and/or BundleBuilder -semistandalone 
> do to handle this?
>
> Another note. I Always do:
>
> python2.3 setup.py build
>
> when building an extension, rather than just "python", for all the 
> same reasons.

I agree with you, to a small extent, but this pythonX.X business that 
you propose only matters to OS X 10.2 users.  On 10.2, any way you 
slice it, /usr/local/bin isn't in the default path anyways (if I 
remember correctly), so the PATH thing is generally reasonable 
(especially because Apple didn't use Python at all on 10.2.x).

In any case, there's one tiny little problem with what you propose: It 
doesn't do a damn thing for 10.3 users.
	- can't accommodate for minor versions (f.ex Apple Python 2.3.0 and 
your own Python 2.3.3)
	- can't accommodate build parameters debug build vs normal build
	- can't accommodate "distribution mechanism" (fink vs vendor vs user 
Python)

People who are getting version mismatch problems are on 10.3, not 10.2. 
  If you compiled an extension with Apple Python 2.2.0 on OS X 10.2, 
there's almost no way that you could accidentally load it from Python 
2.3.x, and vice versa.  That is certainly not true if you have a user 
installation of Python on OS X 10.3.

-bob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2357 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040126/44645f7d/smime.bin


More information about the Pythonmac-SIG mailing list