working with OpenOffice Calc

2016-07-27 Thread id23...@gmail.com
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 "", line 1, in  
  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 "", line 1, in 
  File "/Python/ve/accounting/lib/python2.7/site-packages/pyoo.py", line 26, in 

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

-- 
https://mail.python.org/mailman/listinfo/python-list


Inheritance in Python

2017-04-24 Thread id23...@gmail.com

I do not quite understand how inheritance works in Python.
I use python 3.6.1.
Let say I have a directory structure /a, /b. These two paths described 
in main class.
The second class describes additional structure in one of the main 
structures, say on /b and it should look like this:

/b/id1
/b/id2
/b/id3
/b/id4

Here is what I try to do:

class mainCL():
def __init__(self):
self.path1 = "/a"
self.path2 = "/b"

class secondCL(mainCL):
def __init__(newID):
self.pathID = self.path2+"/id"+str(newID)

# main part of the script
secondaryStructure = []
mainStructure = mainCL()
for id in range(0,3):
secondaryStructure[id] = secondCL(id+1)

The error message tells that object secondCL does not have attribute path2.
How do I define class secondCL?
How to use attribute from class mainCL in class secondCL?
How to use class secondCL in a right way? Do I need to pass class mainCL 
as a parameter?



--
https://mail.python.org/mailman/listinfo/python-list