3 # Fix Python script(s) to reference the interpreter via /usr/bin/env python.
4 # Warning: this overwrites the file without making a backup.
11 for filename
in sys
.argv
[1:]:
13 f
= open(filename
, 'r')
14 except IOError as msg
:
15 print(filename
, ': can\'t open :', msg
)
18 if not re
.match('^#! */usr/local/bin/python', line
):
19 print(filename
, ': not a /usr/local/bin/python script')
24 line
= re
.sub('/usr/local/bin/python',
25 '/usr/bin/env python', line
)
26 print(filename
, ':', repr(line
))
27 f
= open(filename
, "w")
32 if __name__
== '__main__':