print "log redirect to file ", (self.log_dir+"/"+self.log_file)
p=subprocess.Popen(args, shell=False, #does not create sh process
- stdout=log_redirect,
- stderr=output_redirect)
+ stdout=output_redirect,
+ stderr=log_redirect)
pid = p.pid
if(DEBUG):
print "BitTorrentClientRun: pid =", pid
"""
import sys
+import os
import os.path
from BitTorrentClientRun import BitTorrentClientRun
-DEBUG = False
+DEBUG = True
class TriblerRun(BitTorrentClientRun):
f = open(filename, "r");
f_copy = open(tmp_filename, "w");
import_line = "import sys"
- instr_line = "\nsys.path.append('"+base_path+"')\n"
+ instr_line = "sys.path.append('"+base_path+"')\n"
exists = False
position = -1
exists = False
for line in f:
- if line.find("import")>=0 and line.find("sys")>=0 and (not line.find("sys."))>=0:
+ if line.find("import")>=0 and line.find("sys")>=0 and (not (line.find("sys.")>=0)):
#position = f.tell() + len(line) + 1
f_copy.write(line)
- f_copy.write(instr_line)
+ f_copy.write("\n" + instr_line)
continue
if line == instr_line:
exists = True