Forum > Packages and Libraries

Python4Lazarus Undefined symbol: PyExc_ValueError

(1/2) > >>

Grew:
I have inherited an old but essential app that connected from lazarus to LinuxCNC through PythonForLazarus.  The older version has been running on python 2.7 for many years.  Owing to the need to software upgrade I am trying to reconfigure to newer installation.  So I am at this point:-

- I can use CLI to connect to linuxCNC and have no problems. 

- Demo Python packages from LinuxCNC run with no problem.

- A test application set up as per the video on Youtube by Al As works exactly as expected.

So it seem that the configurations are correct, however as soon as I enter the python command "import linuxcnc" I get the PyExc_ValueError.  (I do not get any error for this in the CLI)

OS Debian12  installed from linuxCNC's live distro with PreemptRT.
Lazarus 3.4 and FPC 3.2  as installed with fpcupdeluxe.
Python 3.11 ( required for linuxCNC?)

I did an environment comparison between the CLI and Python4Lazarus setups.  The results show only that Python4Lazarus did not have the Pythonpath set.  I added that to the Pythonengine property, but to no avail. ( I attempted a few other methods as well)

  PythonEngine1.PythonPath := '/usr/lib/python3/dist-packages';

I have spent two day solid fighting with this. I am not an experienced programmer so I have probably overlooked something obvious. (please be patient) I have trawled the forums and run all the AI's dry.   I urgently need assistance:(

Jurassic Pork:
Hello,
look at attachment my PythonEngine settings working on Ubuntu 20.04  Lazarus 2.2
be sure that there is no multiple python versions on your os or connect pythonEngine to your 3.11 version via settings.
Friendly, J.P

Grew:
I do have to thank you J.P.  I do believe it was the correct DllPath that got me over the line. %)

AlexTP:
  PythonEngine1.PythonPath := '/usr/lib/python3/dist-packages';

I am not sure this works at all.
in CudaText i never use PythonPath prop.
and Python4Lazarus main aim is CudaText.
CudaText uses this code


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  PythonEng.UseLastKnownVersion:= False;  PythonEng.DllPath:= ExtractFilePath(SLibItem);  PythonEng.DllName:= ExtractFileName(SLibItem);  PythonEng.LoadDll;
so try to use DllPath/DllName props.

Grew:
Just to clarify, it was DllPath set to /usr/lib/x86_64-linux-gnu/ that fixed it for me.  And yes, I dropped the PythonPath property.

(You know, when you don't know, you just don't know. ;D  )

Of interest, this app also uses

   DllPath := ExtractFilePath

method, but the parameter was hard coded into the App as:- 

/usr/lib/libpython2.7.so.1.0'

which worked fine for the old version.

In your case what is the origin of SLibItem (hope it's not a stupid question?)

Navigation

[0] Message Index

[#] Next page

Go to full version