zhukovgreen
zhukovgreen

Reputation: 1648

Can't import freecad.so with python3

I have problem while import FreeCAD.so into my module with python3. When do the same thing with python2 - it works.

The source code is simple:

import FreeCAD as fc
print(fc)
assert False

I already have /usr/lib/freecad/lib/ in the $PYTHONPATH

Python2:   
name@name:/mnt/E0CA2445623DA14/Temp/GDrive/__PROJECTS/204_TORPEDO/PIM/trpdalgs/app/Laymodel$ python2 __PetrV_Laymodel.py
    FreeCAD 0.16, Libs: 0.16R6707 (Git)
    Fasteners workbench Loaded
    Sheet Metal workbench loaded
    <module 'FreeCAD' from '/usr/lib/freecad/lib/FreeCAD.so'>
    Traceback (most recent call last):
      File "__PetrV_Laymodel.py", line 8, in <module>
        assert False
    AssertionError


Python3:   
name@name:/mnt/E0CA2445623DA14/Temp/GDrive/__PROJECTS/204_TORPEDO/PIM/trpdalgs/app/Laymodel$ python3 __PetrV_Laymodel.py
        Traceback (most recent call last):
          File "__PetrV_Laymodel.py", line 6, in <module>
            import FreeCAD as fc
        ImportError: dynamic module does not define module export function (PyInit_FreeCAD)

Upvotes: 2

Views: 1570

Answers (2)

zhukovgreen
zhukovgreen

Reputation: 1648

Since time has passed and FreeCAD evolves we have a Python3.6 docker image (I am the author):

https://github.com/ZhukovGreen/docker-freecad-cli

It has a python3.6 version of a freecad-cli. No GUI yet

Upvotes: 2

Yorik
Yorik

Reputation: 31

FreeCAD doesn't support python3 yet. This is being worked on and should be available in a next version

Upvotes: 3

Related Questions