你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 04:56:51 +08:00
Better redirection of stdout when processing Python blocks.
这个提交包含在:
@@ -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
|
||||
|
||||
|
在新工单中引用
屏蔽一个用户