You are not logged in.

#1 2011-08-04 11:48:07

Sweeper
Member
Registered: 2011-08-04
Posts: 15

/usr/bin/env python or python2

My old python scripts wont work becaulse of the "/usr/bin/env python" shabang line. How to safely change this, so that i wont have to replace shabang in all my scripts to "/usr/bin/env python2"?

Thanx

Offline

#2 2011-08-04 11:55:07

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,670
Website

Re: /usr/bin/env python or python2

Change to a distro that uses python2 as /usr/bin/python.

Offline

#3 2011-08-04 11:55:52

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: /usr/bin/env python or python2

You can use sed to easily do the replacing.

Offline

#4 2011-08-04 12:24:39

Sweeper
Member
Registered: 2011-08-04
Posts: 15

Re: /usr/bin/env python or python2

Thanx. Problem is - next time i try a new distro (as Allan suggested), I'll have to replace them again. Is there some other way?

Offline

#5 2011-08-04 12:27:36

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: /usr/bin/env python or python2

Offline

#6 2011-08-04 12:30:37

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,670
Website

Re: /usr/bin/env python or python2

When this gets moved from draft, you can tell the other distro to provide a python2 symlink (or just do it yourself) - http://www.python.org/dev/peps/pep-0394/

Offline

#7 2011-08-04 13:09:23

Sweeper
Member
Registered: 2011-08-04
Posts: 15

Re: /usr/bin/env python or python2

2karol: thanx. I saw it, but didnt read it carefully.

Offline

Board footer

Powered by FluxBB