Hi guys,
I’m struggling for several days to setup a Python development environment for LibreOffice on Windows. Though basically I’ve resolved all the issues, I wasn’t expecting it was that hard… The most ironically, in order to write scripts in Python, you have to be a C++ developer, or you just fail setting everything up So closer to the topic. My aim was to have a basic IDE (Spyder works fine for me), with debugging and code completion. Here are some major problems I’ve faced with:
- There is no ensurepip and no venv modules in LO’s Python. Why?
- There are also missing some standard modules like sqlite3, which are dependencies for third-party stuff. But while I could just copy ensurepip and venv from another Python distribution, I couldn’t do that for sqlite3, since it has PYD module which is binary incompatible with PYTHON3.DLL from LO. I was able to overcome it with installing pysqlite3 module, and symlinking it to pretend its sqlite3, but it wasn’t simple too, since LO is missing Python headers and most important, import libraries for PYTHON3.DLL (which is just a shim DLL and is incomplete, missing some required exports). I was able to overcome this by recreating necessary python3.lib by hand, using tools from Microsoft SDK and PYTHON310.DLL as a source. Having this done, sqlite3 dependency was resolved and seems working fine.
- Another issue is missing pythonw.exe in LO distribution, which is required for Spyder to run. Copying the one from another Python distro of the same version and arch doesn’t work, since it’s not binary compatible. I was able to workaround this with symlinking python.exe to pythonw.exe, but now I have an extra console window showing up when Spyder is run.
So, my wish for LibreOffice for Windows is it’s embedded Python would include all the standard tools and modules it has in standalone setup, including headers and libraries for compiling stuff with pip and MSVC (when no wheel package is available). This should make developing scripts a bit easier on Windows.
Regards,
sag