How to handle errors?
D'Arcy Cain
darcy at vex.net
Thu Oct 20 23:13:55 EDT 2016
On 2016-10-20 08:03 PM, Wildman via Python-list wrote:
> Using a direct path to the Python interpreter can cause problems
> on some systems because it is not always installed to the same
> directory. On my Debian-based system Python is installed in
> /usr/bin. So your code as written will not run on my system.
> A workaround for this is to use env in the shebang/hashbang.
>
> For Python 2: #!/usr/bin/env python
Which would fail on my system because that's Python 3.5.
> For Python 3: #!/usr/bin/env python3
>
> It will not matter where Python is installed. 'env' will always
> know where it is.
Nothing is perfect. I have just started linking /usr/bin/python* to
wherever the actual one is on all my systems. If I distribute something
I expect the package manager on the target system to rewrite it as
necessary. I use NetBSD pkgsrc (which runs on many systems besides
NetBSD) and it rewrites the HB line.
--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:darcy at Vex.Net
VoIP: sip:darcy at Vex.Net
More information about the Python-list
mailing list