Open EmiShiraishi opened 3 years ago
Hello again I could solve this problem by myself..! It has worked when I inserted the modules under the folder below.
'C:\Program Files\cadwork.dir\EXE_27\PCLIB.x64\python38' (sys.path)
I am looking forward to expanding the possibility of cadwork by using the API! Thanks a lot for your contribution again!
Hi @EmiShiraishi FYI: While your solution works, there is another alternative: If you have a separate directory or virtualenv with your additional python packages, you can add that path in sys.path as shown here: https://gist.github.com/fbpyr/ad9dd650212ca60b7d00d283755ee58a 🙂 This comes with the following advantages:
Program Files
HI @fbpyr,
After appending libraries to sys and having them available for import, cadwork crashes after the first run if pandas is used.
With other libraries, like ifcopenshell, it seems to work fine. Have you had any similar experience with pandas and cadwork at all?
Hi @ivan-modelical which cadwork version do you use?
I had the run-only-once-then-crash problem you are
describing a lot on cadwork 27, but after switching to
cadwork 28 I could switch between running the addin
and main cadwork application, as long as I terminate my
pt_python session via sys.exit()
, which is clearly more
enjoyable than the run-once version. 🙂
I can however reproduce your scenario with pandas or numpy only being importable once in a cadwork session. Maybe they (or just numpy since pandas depends on numpy) are doing something special in C* ? Would be interesting to know the root cause.
Hi @fbpyr , using v28 Build 238
It only happens with pandas, as you say. I'm using it inside a script called from the API menu bar in the UI, not from the console, and it crashed after first run always.
Hi all, a quick update for anyone interested
xlsxwriter library seems to work and not crash cadwork v28 for writing to excel.
Pandas and OpenPyxl both crash v28 after first run.
Hello! Thanks a lot for producing the awesome API !! I have one question if it is possible to use "external modules" in CwAPI3D Python. (etc rhino3dm, pandas..) When I launched the Python console directly, it was working. However when I launched the Python console through Cadwork 3d, it was not working, and I got an error "ERROR: No module named ''--file name--", even though the external modules are in the same folder. .... I am really happy if I could get the tip to solve this problem! Thanks