Replies: 1 comment
-
def run_cgx():
if not os.path.isfile(CGX_PATH):
state.output = f"ERROR: cgx not found:\n{CGX_PATH}\n"
return
if not os.path.isfile(FBD_PATH):
state.output = f"ERROR: cgx.fbd not found:\n{FBD_PATH}\n"
return
state.output += "\nRunning CGX...\n"
def worker():
try:
p = subprocess.Popen(
[CGX_PATH, "-b", FBD_PATH],
cwd=FBD_DIR,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
)
for line in p.stdout:
with state:
state.output += line
with state:
state.output += f"\n--- CGX finished ({p.returncode}) ---\n"
except Exception as e:
with state:
state.output += f"\nERROR: {e}\n"
threading.Thread(target=worker, daemon=True).start()
ctrl.run_cgx = run_cgx |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a simple program to run an external program (ccx.exe and cgx.exe, CalculiX solver and prepost), how can I capture their output from the terminal and display it live in a window (trame)?
The script works in such a way that at the start it displays the information "Running CGX..." but it does not display the live output from cgx, after clicking the start button again only then it updates and you can see the previous output of the cgx process.
Beta Was this translation helpful? Give feedback.
All reactions