XylotrechusZ

XylotrechusZ Shell

: /lib64/python2.7/Tools/scripts/ [ drwxr-xr-x ]
Uname: Linux premium294.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
Software: LiteSpeed
PHP version: 8.1.32 [ PHP INFO ] PHP os: Linux
Server Ip: 104.21.16.1
Your Ip: 216.73.216.223
User: mjbynoyq (1574) | Group: mjbynoyq (1570)
Safe Mode: OFF
Disable Function:
NONE

name : fixps.py
#! /usr/bin/python2.7

# 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, 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()
© 2025 XylotrechusZ