hi I have some python code
which is generated dynamically which produces python2 code and this python generated code is executed and it's output is then used by downstream application, the problem I have is my code conversion seems to be hanging at these lines
RefactoringTool: Files that were modified:
RefactoringTool: x.py
can someone take a look and let me know what could be wrong.
python_code = """
def greet(name):
print("Hello, {0}!".format(name))
print "What's your name?"
name = input()
greet(name)
"""
with open('x.py', 'a') as the_file:
the_file.write(python_code)
import subprocess
subprocess.run(["2to3-3.6", "-w", 'x.py', "/dev/null"])
op = subprocess.check_output(["python3", 'x.py'])
subprocess.run("rm", "-rf" ,"x.py")
subprocess.run("rm", "-rf" ,"x.py.bak")
print(op)
You're executing the x.py
file, which is waiting for input()
.
Press enter, and your script will end