working with OpenOffice Calc

id23092 at gmail.com id23092 at gmail.com
Wed Jul 27 13:54:47 EDT 2016


I am looking for a library that will allow me to work with Calc documents from Python.
But so far I was not able to build properly working environment for that.
Here is what I already tried.
Installed uno and unotools for Python 2.7, but importing unotools gives an error:
UNO tools are installed: 
(accounting) $ pip list | grep uno 
uno (0.3.3) 
unotools (0.3.3) 

Try to import them: 

(accounting) $ python 
Python 2.7.12 (default, Jun 29 2016, 12:53:15) 
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import uno 
>>> import unotools 
Traceback (most recent call last): 
  File "<stdin>", line 1, in <module> 
  File "/Python/ve/accounting/lib/python2.7/site-packages/unotools/__init__.py", line 16 
    def __init__(self, name: str): 
                           ^ 
SyntaxError: invalid syntax 
>>> 


I also tried to install pyoo, but it is also failing on import:

(accounting) $ pip list |grep pyoo
pyoo (1.1)

(accounting) $ python
Python 2.7.12 (default, Jun 29 2016, 12:53:15)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyoo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Python/ve/accounting/lib/python2.7/site-packages/pyoo.py", line 26, in <module>
    FORMAT_TEXT = uno.getConstantByName('com.sun.star.i18n.NumberFormatIndex.TEXT')
AttributeError: 'module' object has no attribute 'getConstantByName'
>>>


Could someone point me to the right direction to solve the issue.

Regards
Leonid




More information about the Python-list mailing list