CivilPython unable to load standard libraries
htlcnn opened this issue · 2 comments
htlcnn commented
Hi,
I'm using CivilPython with Civil 3D 2020.
I'm not able to import standard libraries such as os
. Here's the code:
import os
And the Exception thrown:
Traceback (most recent call last):
File "....\script.py", line 1, in <module>
ImportError: No module named os
Please give some instructions on how to attach IronPython Standard Library to CivilPython.
Thanks!
paoloemilioserra commented
import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
htlcnn commented
Thanks. I wonder if there is other way to embed IronPython stdlib into CivilPython.dll so that it doesn't rely on client's installation path?
Edit: Nevermind, I've found solution at: https://github.com/eirannejad/pyRevit/blob/master/dev/pyRevitLoader/Source/ScriptExecutor.cs#L136-L146
Thanks a lot for your help. And please remember to escape your strings.