I am running Windows 7, Python 3.6 and LibreOffice 5.4.2.2 (installed in this order).
GOAL: install and use pyuno on Python 3.6 outside LibreOffice (standalone IDE, int his case: PyCharm 2017.2.3 Community Edition). I would like to be able to run the scripts operating on Calc sheets, just as I can on Excel using Pandas.
PROBLEM: when trying to execute script with "import uno" in the beginning, I get missing elements error:
File "C:\Users\Adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\uno\__init__.py", line 4, in <module>
from base import Element, Css, Payload, UnoBaseFeature, UnoBaseField
ImportError: cannot import name 'Element'
I could not install the 'Element' neither using pip nor pip3.6. I installed pyuno via pip3.6 install uno.
I tried installing using python3-uno:
C:\Users\Adam\AppData\Local\Programs\Python\Python36-32\Scripts>pip3.6 install python3-uno
Collecting python3-uno
Could not find a version that satisfies the requirement python3-uno (from versions: )
No matching distribution found for python3-uno
The same result is for pip3.6 (and pip) install python-uno.
I am guessing (or rather read on some other thread) and the init__.py file may be in conflict between my Pycharm/python 3.6 and Python 3.5, which comes with Libre Office but I do not know what to do about it.
If you know how to get this thing to work or where to obtain the missing Element, your support would be greatly appreciated.
I'm trying to do something similar.
If you downloaded uno using pip, it may not be the thing you're looking for. (https://pypi.org/project/pyoo/ see 'Prerequisites').
Also, many places I have read explicitly said the system version of python MUST match the LibreOffice or Openoffice python version.
I briefly experimented with modifying the PYTHONPATH by using
''' import sys
sys.append('path to pyuno under LibreOffice 5 folder')
import pyuno '''
but it resulted in my command window just freezing. I did not try resetting the URE_BOOTSTRAP, so that might work.
Otherwise, many have said that to operate on OpenOffice or LibreOffice with an incompatible version of python, you should use the COM (Component Object Model) methods/tools, though I have no experience with this, and the documentation is not great. I did find this book and presentation, but it involves a lot of research I have not finished:
book:https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwje0u7QuMLbAhXLFzQIHcexAdUQFgg8MAE&url=http%3A%2F%2Fwww.datatime.org%2Fe%2Fupload%2Fs1%2Ffck%2Ffile%2F2017%2F01%2F11%2F1008283040.pdf&usg=AOvVaw2Q5uuLBlc7Adlami3-D1xa
presentation: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&uact=8&ved=0ahUKEwihor7PucLbAhVjNn0KHbb7AyQQFgg3MAM&url=http%3A%2F%2Fftp.ntua.gr%2Fmirror%2Fpython%2Fwindows%2Fwin32com%2FCOMTutorial.ppt&usg=AOvVaw0VkCgHsto0LR1q5o1EygMp
I'm going to try reading the data using ezodf or pyexcel-ods, then performing other operations on the data from there. Maybe something like that would work for you too, in case there isn't another way of accessing UNO or pyuno from the system python.
If that doesn't work, I'll try resetting URE_BOOTSTRAP
Best of luck!