Better redirection of stdout when processing Python blocks.

这个提交包含在:
Craig Warren
2016-04-26 17:23:38 +01:00
父节点 5d6f2d0d24
当前提交 0e0d842556

查看文件

@@ -45,6 +45,9 @@ def process_python_include_code(inputfile, usernamespace):
# Process any Python code
if(inputlines[x].startswith('#python:')):
# Save stdout location to restore later
stdout = sys.stdout
# String to hold Python code to be executed
pythoncode = ''
x += 1
@@ -67,6 +70,9 @@ def process_python_include_code(inputfile, usernamespace):
# Add processed Python code to list
processedlines.extend(codeproc)
# Reset stdio
sys.stdout = stdout
# Process any include commands
elif(inputlines[x].startswith('#include:')):
includefile = inputlines[x].split()
@@ -94,8 +100,6 @@ def process_python_include_code(inputfile, usernamespace):
processedlines.append(inputlines[x])
x += 1
sys.stdout = sys.__stdout__ # Reset stdio
return processedlines