Skip to content

Commit feed5ba

Browse files
Minimal fix for bug where interactive sessions would crash when trying to use use() or include()
1 parent bca81c3 commit feed5ba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

solid/solidpython.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,11 @@ def calling_module( stack_depth=2):
646646
'''
647647
frm = inspect.stack()[stack_depth]
648648
calling_mod = inspect.getmodule( frm[0])
649+
# If calling_mod is None, this is being called from an interactive session.
650+
# Return that module. (Note that __main__ doesn't have a __file__ attr,
651+
# but that's caught elsewhere.)
652+
if not calling_mod:
653+
import __main__ as calling_mod
649654
return calling_mod
650655

651656
def new_openscad_class_str( class_name, args=[], kwargs=[], include_file_path=None, use_not_include=True):

0 commit comments

Comments
 (0)