How to handle errors?

Wildman best_lay at yahoo.com
Thu Oct 20 20:03:17 EDT 2016


On Thu, 20 Oct 2016 12:48:28 -0700, SS wrote:

> The following script works fine:
> 
> #!/bin/python

I meant to include this with my other post but I forgot it.

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

For Python 3:  #!/usr/bin/env python3

It will not matter where Python is installed.  'env' will always
know where it is.

-- 
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!



More information about the Python-list mailing list