patch_modpython.py

changeset 45
9a18f4dbb493
parent 15
f6ccc31d6e72
child 433
988006cb898f
child 792
a13346916170
equal deleted inserted replaced
44:fe5cd20cb0eb 45:9a18f4dbb493
74 global modDir 74 global modDir
75 modDir = arg 75 modDir = arg
76 76
77 try: 77 try:
78 filename = os.path.join(modDir, "apache.py") 78 filename = os.path.join(modDir, "apache.py")
79 f = open(filename, "r") 79 f = open(filename, "r", encoding = "utf-8")
80 except EnvironmentError: 80 except EnvironmentError:
81 print("The file %s does not exist. Aborting." % filename) 81 print("The file %s does not exist. Aborting." % filename)
82 sys.exit(1) 82 sys.exit(1)
83 83
84 lines = f.readlines() 84 lines = f.readlines()
86 86
87 pdbFound = False 87 pdbFound = False
88 ericFound = False 88 ericFound = False
89 89
90 sn = "apache.py" 90 sn = "apache.py"
91 s = open(sn, "w") 91 s = open(sn, "w", encoding = "utf-8")
92 for line in lines: 92 for line in lines:
93 if not pdbFound and line.startswith("import pdb"): 93 if not pdbFound and line.startswith("import pdb"):
94 s.write("import eric5.DebugClients.Python.eric5dbgstub as pdb\n") 94 s.write("import eric5.DebugClients.Python.eric5dbgstub as pdb\n")
95 pdbFound = True 95 pdbFound = True
96 else: 96 else:

eric ide

mercurial