Python 3.6 causes error, python 3.5 does not.
Jim
jf_byrnes at comcast.net
Sun May 20 15:03:44 EDT 2018
Mint 18
Libreoffice 5.1.6.2
Python 3.6.5 in one virtual environment
Python 3.5.2 in another
I am writing a script that uses pyautogui to get some data and paste it
into a Libreoffice calc file, there by bypassing the complexity of uno.
The problem is it runs fine if I use python 3.5. If I use python 3.6 it
opens the calc file then pops up a dialog saying "std::bad_alloc". There
are no relevant errors in the terminal. At this point I must reload the
file and let calc recover it. I googled "std::bad_alloc" but didn'
This is the portion of the code that causes the error:
import pyautogui
import subprocess
import threading
import time
LONG_ENOUGH = 5
class LO():
'''Manipulate libreoffice not using UNO'''
def __init__(self):
self.filename =
'/home/jfb/Documents/Financial/Investing/Stocks.ods'
opener = threading.Thread(target=self.open_it,
args=(self.filename,))
opener.start()
time.sleep(5) #LONG_ENOUGH)
#self.manipulate_LO()
#Open and work with libreoffice
def open_it(self, filename):
#subprocess.call(["libreoffice", filename])
subprocess.run(["libreoffice", filename])
lo = LO()
To complicate matters not all .ods files show this problem. I ran some
tests. Two of my .ods files are effected but a couple of others are not.
A new test file I created is not effected.
I don't know if I have a Libreoffice problem, file corruption or a
Python problem. The fact that 3.6 gives an error but 3.5 does not is the
reason I decided to ask here first.
Regards, Jim
More information about the Python-list
mailing list