[Pythonmac-SIG] Python bindings for DB XML
Chris Barker
Chris.Barker at noaa.gov
Mon Jan 26 12:17:31 EST 2004
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.
-Chris
More information about the Pythonmac-SIG
mailing list