I have troubles importing FreeCAD in a Python script.
Following the example in https://www.freecadweb.org/wiki/Embedding_FreeCAD, my script is:
Code: Select all
#!/usr/bin/env python
# coding: utf-8
import sys
sys.path.append('/snap/freecad/8/opt/local/FreeCAD-0.18/lib')
import FreeCAD
Code: Select all
Traceback (most recent call last):
File "/home/jamal/PycharmProjects/OptiSav/processes/freecad_stl.py", line 16, in <module>
import FreeCAD
ImportError: libFreeCADApp.so: cannot open shared object file: No such file or directory
When I try to import libFreeCADApp.so first, the ImportError points to libFreeCADBase.so. And when I try to import libFreeCADBase, the ImportError points to libxerces-c-3.1.so, which is present in '/snap/freecad/8/usr/lib/x86_64-linux-gnu'. Appending this directory to sys.path does not help.
Ubuntu 18.04.3 LTS 64bit
Python '3.7.6 (default, Jan 8 2020, 19:59:22) \n[GCC 7.3.0]'
FreeCAD 0.18, Libs: 0.18R16093 (Git)