Skip to content

Commit

Permalink
Merged in cbillington/labscript/bugfix (pull request labscript-suite#44)
Browse files Browse the repository at this point in the history
Do not assume `__file__` is not None if it exists.

Approved-by: Philip Starkey <[email protected]>
  • Loading branch information
chrisjbillington committed Jan 18, 2019
2 parents 932395c + c39974b commit aea6cdf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion labscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -2039,7 +2039,7 @@ def save_labscripts(hdf5_file):
import labscriptlib
prefix = os.path.dirname(labscriptlib.__file__)
for module in sys.modules.values():
if hasattr(module,'__file__'):
if getattr(module, '__file__', None) is not None:
path = os.path.abspath(module.__file__)
if path.startswith(prefix) and (path.endswith('.pyc') or path.endswith('.py')):
path = path.replace('.pyc', '.py')
Expand Down

0 comments on commit aea6cdf

Please sign in to comment.