Back to index

python3.2  3.2.2
Functions
fixps Namespace Reference

Functions

def main

Function Documentation

def fixps.main ( void  )

Definition at line 10 of file fixps.py.

00010 
00011 def main():
00012     for filename in sys.argv[1:]:
00013         try:
00014             f = open(filename, 'r')
00015         except IOError as msg:
00016             print(filename, ': can\'t open :', msg)
00017             continue
00018         line = f.readline()
00019         if not re.match('^#! */usr/local/bin/python', line):
00020             print(filename, ': not a /usr/local/bin/python script')
00021             f.close()
00022             continue
00023         rest = f.read()
00024         f.close()
00025         line = re.sub('/usr/local/bin/python',
00026                       '/usr/bin/env python', line)
00027         print(filename, ':', repr(line))
00028         f = open(filename, "w")
00029         f.write(line)
00030         f.write(rest)
00031         f.close()

Here is the call graph for this function: