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
When I change the examples/basic_scad_include.py file to use the demo_scad_use function instead of the demo_import_scad function SolidPython is -- at least in my environment -- not able to resolve scad_to_include.scad in certain situations.
Running basic_scad_include.py (with demo_scad_use enabled) from a directory that is not in sys.path results in the following trace:
jeff@nups ~/code $python3 SolidPython/solid/examples/basic_scad_include.py
Traceback (most recent call last):
File "SolidPython/solid/examples/basic_scad_include.py", line 31, in <module>
a = demo_scad_use()
File "SolidPython/solid/examples/basic_scad_include.py", line 26, in demo_scad_use
return steps(5)
File "<string>", line 4, in __init__
File "/home/jeff/.local/lib/python3.6/site-packages/solid/solidpython.py", line 372, in __init__
self.include_file_path = self._get_include_path(include_file_path)
File "/home/jeff/.local/lib/python3.6/site-packages/solid/solidpython.py", line 396, in _get_include_path
raise ValueError(f"Unable to find included SCAD file: {include_file_path} in sys.path")
ValueError: Unable to find included SCAD file: SolidPython/solid/examples/scad_to_include.scad in sys.path
The issue is caused by the ctor of the IncludedOpenSCADObject. It calls self._get_include_path to resolve the file but the self._get_include_path function -- for some reason -- tries to find the file using the Python-Path (sys.path) to resolve a *.scad file. This seems pretty strange to me and only works by accident if you call it from withing sys.path and/or SolidPython is installed in sys.path (I can't wrap my head around it which combinations it is exactly but these two factors seem to be the key).
Replacing the call to self._get_include_path with a call to objects._find_library seems to work but I'm not sure whether it's supposed to be that way and whether -- or not -- this might have side effects.
Note: when using import_scad everything is fine.
The text was updated successfully, but these errors were encountered:
jeff-dh
added a commit
to jeff-dh/SolidPython
that referenced
this issue
May 22, 2021
When I change the
examples/basic_scad_include.py
file to use thedemo_scad_use
function instead of thedemo_import_scad
function SolidPython is -- at least in my environment -- not able to resolvescad_to_include.scad
in certain situations.Running basic_scad_include.py (with demo_scad_use enabled) from a directory that is not in
sys.path
results in the following trace:The issue is caused by the ctor of the
IncludedOpenSCADObject
. It callsself._get_include_path
to resolve the file but theself._get_include_path
function -- for some reason -- tries to find the file using the Python-Path (sys.path) to resolve a *.scad file. This seems pretty strange to me and only works by accident if you call it from withingsys.path
and/or SolidPython is installed insys.path
(I can't wrap my head around it which combinations it is exactly but these two factors seem to be the key).Replacing the call to
self._get_include_path
with a call toobjects._find_library
seems to work but I'm not sure whether it's supposed to be that way and whether -- or not -- this might have side effects.Note: when using import_scad everything is fine.
The text was updated successfully, but these errors were encountered: