Python Forum
programming OpenOffice with External Python Project
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
programming OpenOffice with External Python Project
#1
I am unable to program Openoffice documents from a python project.

Here is my Python code:

filename = 'somefile.ods'

import Danny.OOo.OOoLib as OOoLib
import unohelper
import os.path

url = unohelper.systemPathToFileUrl(
    os.path.abspath(filename))
desktop = OOoLib.getDesktop()
doc = desktop.loadComponentFromURL(
    url, "_blank", 0, () )
The error I get is:
Error:
File "c:\users\public\documents\python\openofficetest.py", line 3, in <module> import Danny.OOo.OOoLib as OOoLib File "c:\users\public\documents\python\Danny\OOo\OOoLib.py", line 38, in <module> import uno ModuleNotFoundError: No module named 'uno'
First I am not sure which folder to put the “Danny.OOo.OOoLib as OOoLib”
Second what does the “No module named 'uno” error mean?

Can anyone answer this and show what is needed to eliminate the errors and have Python talk to OpenOffice.
buran write Apr-07-2023, 05:58 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply
#2
(Apr-07-2023, 05:24 AM)bobthebuilder44 Wrote: First I am not sure which folder to put the “Danny.OOo.OOoLib as OOoLib”
Not sure what you mean by that question. you have folder c:\users\public\documents\python\Danny\OOo\ and you import module OOoLib (that is the file OOoLib.py) Isn't that what you want? Is this module that you wrote?

(Apr-07-2023, 05:24 AM)bobthebuilder44 Wrote: Second what does the “No module named 'uno” error mean?
In the above mentioned module you try to import module uno and the interpreter cannot find it. Is this something you wrote or installed? Also, I see that in this script you import unohelper - is this something different?
Looking further into this, I guess you try to use the first of these
https://wiki.openoffice.org/wiki/Danny%2...on_Modules

Then some googling and as far as I understand it is trying to use PyUNO, which is integrated in OO. I suggest that you check this tutorial, incl. on how to start it.

https://www.openoffice.org/udk/python/py...l#tutorial
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Programming robots using Python OscarBoots 5 3,465 Oct-31-2021, 09:38 AM
Last Post: Larz60+
  How to send data from a python application to an external application aditya_rajiv 1 2,189 Jul-26-2021, 06:00 AM
Last Post: ndc85430
  Programming Difficult math in Python Huntern 6 4,771 Oct-17-2019, 06:32 AM
Last Post: Huntern
  Inconsistency in Python programming language? newbieAuggie2019 31 11,488 Oct-06-2019, 03:21 PM
Last Post: adt
  How can I move in an external program via Python? Pythoner 0 2,280 Dec-29-2018, 12:43 PM
Last Post: Pythoner
  Python Programming Projects for Beginners jack_sparrow007 3 3,331 Dec-26-2018, 07:52 PM
Last Post: micseydel
  Programming Python as a MS Windows app? Brian123 8 4,256 Oct-17-2018, 10:26 PM
Last Post: Brian123
  programming external 93C66 EEPROM with Arduino UNO Mantix 0 2,957 Sep-22-2018, 06:52 AM
Last Post: Mantix
  Help with Python programming mediaos 5 3,762 Aug-08-2018, 01:02 PM
Last Post: Larz60+
  Project programming advice aurora10 1 2,176 Apr-26-2018, 04:46 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020