-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Description
I get the following error when trying to send my experiment shot in runmanager:
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'n' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\naqsL\labscript-suite\labscript_suite\runmanager\runmanager\batch_compiler.py", line 67, in compile
labscript.labscript_init(run_file, labscript_file=labscript_file)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\naqsL\labscript-suite\labscript_suite\labscript\labscript\labscript.py", line 765, in labscript_init
load_globals(hdf5_filename)
~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "C:\Users\naqsL\labscript-suite\labscript_suite\labscript\labscript\labscript.py", line 726, in load_globals
raise LabscriptError('ERROR whilst parsing globals from %s. \'%s\''%(hdf5_filename,name) +
'is not a valid Python variable name.' +
' Please choose a different variable name.')
labscript.utils.LabscriptError: ERROR whilst parsing globals from C:\Experiments\example_apparatus\camera_experiment\2026\02\05\0005\2026-02-05_0005_camera_experiment_0.h5. 'n'is not a valid Python variable name. Please choose a different variable name.
Compilation aborted.
A first pass seems to show that in labscript.py the exec('del' + name) seems to fail in the try, except logic
labscript/labscript/labscript.py
Lines 721 to 728 in f1ed9cb
| try: | |
| assert '.' not in name | |
| exec(name + ' = 0') | |
| exec('del ' + name ) | |
| except: | |
| raise LabscriptError('ERROR whilst parsing globals from %s. \'%s\''%(hdf5_filename,name) + | |
| 'is not a valid Python variable name.' + | |
| ' Please choose a different variable name.') |
This is most likely too permissive of a try except block, since the exception is bare and doesn't quite match the behavior (since n is definitely a legal python variable name.
I'm definitely at a loss as to why del can't quite work since the above exec correctly assigns the variable.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels