[Solved] Import pyuno failed, unable to find the module

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
dream2k9
Posts: 5
Joined: Tue Dec 22, 2009 1:19 am

[Solved] Import pyuno failed, unable to find the module

Post by dream2k9 »

Hi,

I need to import the uno module but when I try import uno, the pyuno binding fails with the following error:
ImportError: DLL load failed: Impossibile trovare il modulo specificato.
In English it should sounds like ImportError: DLL load failed: Unable to find the specified module

I googled a lot and read about other users with the same problem but no-one post helped me.

System configuration

I'm using the python 2.6.1 shipped with OpenOffice 3.1.1(OOO310m19, Build:9420). I installed it in C:\Programmi\OpenOffice.org 3\Basis\program and added the python's path to the windows system path :
echo %PATH%
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programmi\OpenOffice.org 3\Basis\program;
I also created a file C:\Programmi\OpenOffice.org 3\Basis\program\python-core-2.6.1\lib\site-packages\whatineed.pth with this content :
C:\Programmi\OpenOffice.org 3\Basis\program
It helps python to find the uno module in the right path.


The Error

And here is the error ::
Python 2.6.1 (r261:67515, Apr 22 2009, 19:31:46) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import uno
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Programmi\OpenOffice.org 3\Basis\program\uno.py", line 33, in <module
>
import pyuno
ImportError: DLL load failed: Impossibile trovare il modulo specificato.
>>>
I also tried to copy pyuno.pyd to c:\WINDOWS\system\pyuno.pyd as suggested in some post without any luck.

Any ideas?

Thanks in advance,
Simone
Last edited by Villeroy on Tue Dec 22, 2009 9:52 pm, edited 1 time in total.
Openoffice 3.1 on Ubuntu Linux 9.10
OpenOffice 3.1 on windows xp
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Import pyuno failed, unable to find the specified module.

Post by Villeroy »

Is C:\Programmi\OpenOffice.org 3\Basis\program the same folder as the one where the office executables are? (soffice.exe, swriter.exe, ...)

On my system I have one path /opt/openoffice.org/basis3.1/program/ which includes some Python libraries among other libraries and I have a similar one /opt/openoffice.org3/program/ where the executables reside, including the Python runtime which has to be used with OpenOffice.org
Can you call macro Tools>Macros>Organize>Python>HelloWorld from a Writer document? It prints "Hello World" into a currently active Writer document.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
dream2k9
Posts: 5
Joined: Tue Dec 22, 2009 1:19 am

Re: Import pyuno failed, unable to find the specified module.

Post by dream2k9 »

hi Villeroy,

thank you very much for your reply. I found the second python binary C:\\Programmi\\OpenOffice.org 3\\program\\python.exe and it worked fine with the import!

So, for future memory :

- C:\\Programmi\\OpenOffice.org 3\\Basis\\program\\python-core-2.6.1\\bin\\python.exe (must not be used to import pyuno, it won't work)
- C:\\Programmi\\OpenOffice.org 3\\program\\python.exe ( the correct intepreter to use, with this one the import will work fine)

Thanks again and Merry Christmas :),
Simone
Openoffice 3.1 on Ubuntu Linux 9.10
OpenOffice 3.1 on windows xp
Post Reply