[Pyobjc-dev] hashbang in applets
Brought to you by:
ronaldoussoren
From: Jack J. <Jac...@or...> - 2003-03-21 22:05:00
|
On vrijdag, maa 21, 2003, at 21:12 Europe/Amsterdam, Ronald Oussoren wrote: > P.S. bundlebuilder.py from the current Python CVS doesn't work for me, > I get #!python2.3 at the start of the bootstrap script. That's > probably because 'which python' is '/usr/local/bin/python' and that > is a symlink to 'python2.3' in the same directory. This fragment of > code doesn't work correctly with that: > hashbang = sys.executable > while os.path.islink(hashbang): > hashbang = os.readlink(hashbang) > > The second time through the loop hashbang is 'python2.3', which > doesn't exist. The assignment should probably be something like > 'os.path.join(os.dirname(hashbang), os.readlink(hashbang))' Don't use this construct, use os.path.realpath(sys.executable). It follows recursive symlinks and understands about relative symlinks too. -- - Jack Jansen <Jac...@or...> http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - |