*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 5138e40a authored by chrisjbillington's avatar chrisjbillington
Browse files

Resolve issue with Run object choosing group name based on script name

Unsure since when this has been broken, but lyse routines used to work
fine outside of lyse, as long as you specified the h5 file. However,
prior to this fix, when instantiating a `Run` object whilst running a
script outside of lyse, `Run.__init__()` fails to introspect the name
of the main script, in order to select the default group name to which
results should be saved.

The previous introspection code likely predates some changes we made
such that traversing a call stack in order to find the top-level script
is no longer necessary. The analysis routine appears in `sys.modules`
as the `__main__` module, as does the top-level script when running an
analysis routine from outside of lyse. So we can just use that. As
before, if the `Run` object finds it is being instantiated in an
unusual environment where there is no `__main__` module in
`sys.modules` or it doesn't have a `__file__`, then we just skip
setting the group name. We used to cough a warning about this, but
that's no longer needed as the user will instead get an exception if
they try to save a result, telling them they they need to set the group
first.
parent ada29b79
No related branches found
No related tags found
1 merge request!1Merge from GitHub repo
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment