|
|
@@ -32,23 +32,23 @@ def convert(origin, target): |
|
|
|
print("cmd:: {0}".format(cmd))
|
|
|
|
args = shlex.split(cmd)
|
|
|
|
# status, output = sp.getstatusoutput(cmd)
|
|
|
|
# print("status:: {0}, output {1}".format(status, output))
|
|
|
|
proc = sp.Popen(args, stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE)
|
|
|
|
answer = b'Overwrite ? [y/N]'
|
|
|
|
try:
|
|
|
|
outs, errs = proc.communicate(timeout=300)
|
|
|
|
print(outs, errs)
|
|
|
|
print("answer in outs : {0}".format(answer in outs))
|
|
|
|
if answer in outs:
|
|
|
|
print('write y')
|
|
|
|
proc.stdin.write(b'y')
|
|
|
|
if proc.returncode == 0:
|
|
|
|
print("{0} convert {1} Success, origin dat will remove!".format(origin, target))
|
|
|
|
os.remove(origin)
|
|
|
|
else:
|
|
|
|
print("{0} convert fail".format(origin))
|
|
|
|
except sp.TimeoutExpired:
|
|
|
|
proc.kill()
|
|
|
|
# print("status:: {0}, output {1}".format(status, output))
|
|
|
|
proc = sp.Popen(args, stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE)
|
|
|
|
answer = b'Overwrite ? [y/N]'
|
|
|
|
try:
|
|
|
|
outs, errs = proc.communicate(timeout=300)
|
|
|
|
print(outs, errs)
|
|
|
|
print("answer in outs : {0}".format(answer in outs))
|
|
|
|
if answer in outs:
|
|
|
|
print('write y')
|
|
|
|
proc.stdin.write(b'y')
|
|
|
|
if proc.returncode == 0:
|
|
|
|
print("{0} convert {1} Success, origin dat will remove!".format(origin, target))
|
|
|
|
os.remove(origin)
|
|
|
|
else:
|
|
|
|
print("{0} convert fail".format(origin))
|
|
|
|
except sp.TimeoutExpired:
|
|
|
|
proc.kill()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|