A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://svn.python.org/projects/python/branches/test_subprocess_10826/Tools/scripts/fixps.py below:

#!/usr/bin/env python3 # Fix Python script(s) to reference the interpreter via /usr/bin/env python. # Warning: this overwrites the file without making a backup. import sys import re def main(): for filename in sys.argv[1:]: try: f = open(filename, 'r') except IOError as msg: print(filename, ': can\'t open :', msg) continue line = f.readline() if not re.match('^#! */usr/local/bin/python', line): print(filename, ': not a /usr/local/bin/python script') f.close() continue rest = f.read() f.close() line = re.sub('/usr/local/bin/python', '/usr/bin/env python', line) print(filename, ':', repr(line)) f = open(filename, "w") f.write(line) f.write(rest) f.close() if __name__ == '__main__': main()

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4