Forum > Packages and Libraries
Python4Lazarus Undefined symbol: PyExc_ValueError
AlexTP:
In CudaText, origin of SLibItem is the option "pylib__linux" which user writes to user.json config.
Grew:
So I went down this rabbit hole again. Had further problems with my live install, but then travelled for Xmass. I wanted to play with the setup so installed the exact same environment on a VirtualBox.
The DLLPath setting alone did not help me this time, so I have a log of all the changes I made. I cannot be sure that everything was required but I am listing here for anyone else that comes across the issue.
### Summary of Actions Taken to Resolve Lazarus-Python Integration Issue
1. **Tested first with Simple App from Al As - https://www.youtube.com/@178alaa **:
- Verified that the Lazarus app compiled but the window would immediately close again when using the `pythonforlazarus` library.
- Confirmed that Python was indeed functioning correctly and interacted correctly with other apps via the CLI(bash).
- Opening of the window was resolved by applying the scrollbar to the TMemo. Why, I do not know. I initially missed this step and thought it not required.
2. **Dependencies and Environment**:
- Ensured all necessary dependencies for Lazarus and Python were installed.
- Installed `python3-dev` libraries to provide header files and static library for Python development.
3. **Configuration in Lazarus**:
- Set `DllPath` to `/usr/lib/x86_64-linux-gnu` and `DllName` to `libpython3.11.so.1.0`.
- Set environment variables in `.bashrc`:
```bash
export PYTHONHOME=/usr
export PYTHONPATH=/usr/lib/python3.11
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
```
4. **Adjusting Lazarus Component Settings**:
- Set `AutoUnload` to True, `FatalAbort` to True, `InitThreads` to True, and `uselastknownversion` to False in the `pythonforlazarus` component settings(object inspector).
5. **Resolving UI Issues**:
- Ticked the scrollbar setting in the Memo component to prevent the window from closing immediately after startup.
- In my other app, Set `LIBOVERLAY_SCROLLBAR` to `0` to address UI-related issues.
6. **Debugging with `strace` and `LD_DEBUG`**:
- Used `strace` to trace system calls and signals:
```bash
strace -f -o trace.log ./YourApplication
```
- Set `LD_DEBUG` to `libs` for detailed information about library loading:
```bash
LD_DEBUG=libs ./YourApplication
```
One or a combination of the above got the test app working and thus my own app as well( Pythonforlazarus not implemented as a UI component).
AlexTP:
All this is unclear to me - what do you suggest for my git repo of Python4Lazarus?
https://github.com/Alexey-T/Python-for-Lazarus
Grew:
Alex, I apologize again for my slow response here. I am inundated at work right now.
I took record and then listed everything I did here in case it helped someone in the future. I would have to start a fresh VM and do it all again to try to refine what exact steps worked.
Navigation
[0] Message Index
[*] Previous page