Problems with path and Python 3.6

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
wmayer
Founder
Posts: 20302
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Problems with path and Python 3.6

Post by wmayer »

surprising to read a sentence in French, I've put the GUI in English.
That's a message coming from your OS, not the application. Does your latest FreeCAD package have the Import.so module?
david69
Veteran
Posts: 1780
Joined: Wed Jan 01, 2014 7:48 pm

Re: Problems with path and Python 3.6

Post by david69 »

wmayer wrote: Sun Jul 17, 2022 10:43 am That's a message coming from your OS, not the application
so the OS can "communicate" and prints in FreeCAD report view, I didn't know.
wmayer wrote: Sun Jul 17, 2022 10:43 am Does your latest FreeCAD package have the Import.so module?
Python and me, we live in a different universe. I've looked for some hints on the net and I did that in a console:

Code: Select all

dvd@dvd:~$ python -c "Import.so"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'Import' is not defined
is the checking correct?
david69
Veteran
Posts: 1780
Joined: Wed Jan 01, 2014 7:48 pm

Re: Problems with path and Python 3.6

Post by david69 »

Catfish is my friend:
Capture du 2022-07-17 17-50-09.png
Capture du 2022-07-17 17-50-09.png (9.57 KiB) Viewed 852 times
so yes, since yesterday, I've got this module.
wmayer
Founder
Posts: 20302
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Problems with path and Python 3.6

Post by wmayer »

david69 wrote: Sun Jul 17, 2022 3:20 pm so the OS can "communicate" and prints in FreeCAD report view, I didn't know.
The .so file is a shared library that couldn't be loaded (via dlopen) for some reason and the error that comes from the OS is forwarded to Python. And since we (can) redirect Python stdout & stderr messages it appears inside FreeCAD.
Python and me, we live in a different universe. I've looked for some hints on the net and I did that in a console:
This won't work. First, of all you must make sure to run Python3 (but the call of python probably starts Python2), then you must add the path to FreeCAD.so to your sys.path. Then you can import FreeCAD and afterwards you can import Import.
so yes, since yesterday, I've got this module.

Code: Select all

python3

Code: Select all

import sys
sys.path.append("/usr/lib/freecad-daily-python3/lib")

import FreeCAD
import Import
david69
Veteran
Posts: 1780
Joined: Wed Jan 01, 2014 7:48 pm

Re: Problems with path and Python 3.6

Post by david69 »

in a console of my OS, here is what I'm doing:

Code: Select all

dvd@dvd:~$ python3
Python 3.6.9 (default, Jun 29 2022, 11:45:57) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import sys
>>> sys.path.append("/usr/lib/freecad-daily-python3/lib")
>>> 
>>> import FreeCAD
>>> import Import
>>> 
I'm learning my OS has two Python versions, a 2.7.17 and a 3.6.9 and I understand why you ask to typewrite first of all python3

once done, I launch FreeCAD and select Path workbench and but still the same previous msg in the report view.
22:16:31 Import.so: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type
22:16:31 Traceback (most recent call last):
File "<string>", line 62, in Initialize
File "/usr/share/freecad-daily/Mod/Path/PathScripts/PathPreferencesPathJob.py", line 24, in <module>
import Path
it seems either I did something wrong or it is useless.
User avatar
manup
Posts: 19
Joined: Sat Jun 19, 2021 6:01 pm

Re: Problems with path and Python 3.6

Post by manup »

Hi, I do experience the same issue as described by @david69, here's what I can share about it when I try to use Path:

Code: Select all

$ python3
Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append("/usr/lib/freecad-daily-python3/lib")
>>> import FreeCAD
>>> import Import
>>> 
>>> 
$ freecad-daily 
FreeCAD 0.21, Libs: 0.21R
© Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2022
FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.
FreeCAD wouldn't be possible without FreeCAD community.
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

User path has changed to /home/manu/.local/share/FreeCAD/. Please move user modules and macros
connect failed: Aucun fichier ou dossier de ce type
Import.so: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type
Traceback (most recent call last):
  File "<string>", line 62, in Initialize
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "/usr/share/freecad-daily/Mod/Path/PathScripts/PathPreferencesPathJob.py", line 24, in <module>
    import Path
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
So, same question here: what's wrong on this Ubuntu 22.04 system running python 3.10.6, did I miss something, what can be done to make it work?
manu
Post Reply