You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I just stumbled upon this behaviour, that the madx instance still accepts commands even after it was closed.
Is this a known "bug"?
Code example:
from cpymad.madx import Madx
madx = Madx()
madx.input("quit;")
madx.print(text="Still Printing")
with madx.exit() and madx.quit() everything is nicely ended (from the python side),
but a quit, exit, stop in the madx-code or madx.stop() only stops the madx run but still accepts commands.
This can be very annoying when quit is called within a file or macro, the cpymad run continues and runs fine (even reading and setting variables) , sporadically one can find messages like this in the output:
+++ memory access outside program range, fatal +++
but the program still continues to run until you do something fancy,
like a twiss, which fails then with a very non-distinct error message:
yeah, I'd probably consider this a user mistake. But you're right, I think adding it to known issues is definitely worth, and we can see later if we want to do anything else about it.
In principle, we could check for the variables final_message or stop_flag before each command and then raise an Exception if they contain a 1.
automatic restarting would probably be a bad idea (makes it harder for user to find the cause the problem), and automatic cleanup of the MAD-X process + python process by checking the stop condition after each command might also be unexpected (you can probably still retrieve some data from MAD-X, even after a quit was executed, and that might be an important use case for some users)
Hey, I just stumbled upon this behaviour, that the madx instance still accepts commands even after it was closed.
Is this a known "bug"?
Code example:
with
madx.exit()
andmadx.quit()
everything is nicely ended (from the python side),but a
quit
,exit
,stop
in the madx-code ormadx.stop()
only stops the madx run but still accepts commands.This can be very annoying when
quit
is called within a file or macro, thecpymad
run continues and runs fine (even reading and setting variables) , sporadically one can find messages like this in the output:but the program still continues to run until you do something fancy,
like a
twiss
, which fails then with a very non-distinct error message:Not sure if it would make sense to check in the output for:
I understand that this is probably not easy to fix, but maybe it should be included into the known issues.
The text was updated successfully, but these errors were encountered: