Closed catbor closed 1 year ago
This error message is occuring at startup when xlOil tries to load the ribbon. It seems to be an escaping COM error. I'll add some code to trap and print this error, but it won't stop the underlying cause and usually COM errors are not particularly descriptive. If you disable the xlOil ribbon I would imagine the problem would go away, although this is not an ideal fix of course!
Are you seeing another error on close? Currently your xlOil log just contains Error statements, whch suggests your loglevel is too high to provide much useful information. It also seems to contain old messages from the previous issue you posted - could you clear the log file then reproduce the error at Debug logging level?
I am observing the same problem. No error on workbook close, but during opening the ribbon load sometimes fails. This is my log on trace logging level, but it doesn't seem to show anything interesting. ribbon_error_log.txt. I have Excel 2010.
Restarting excel eventually fixes it (but I recall it can happen multiple times in a row). I could not find any common denominator that is correlated with this so far. I am ready to test it with a newer version of xloil that has even more logging.
In xlOil v0.16, I've put some better error trapping around this, hopefully this will give us some clue as to the cause. Excel's COM interface can become 'busy' and reject extenal calls or otherwise behave strangely - it's very old code!
Tried it in v0.16 and you are completely right. That's what the error message says. ribbon_error_log.txt
I do have some spurious message boxes appearing during the start of my excel, which is caused by some failed add-in development of mine, but they appear all the time and most of the time xloil loads fine and I cannot see any correlation with the above error. I also tried specifically opening workbooks with "macros disabled" bar, "document recovery" sidebar, because I thought the xloil ribbon fail happens more frequently when these appear, but out of about 5-10 tries I could not make it fail again.
Is it possible to wait for the COM interface being not-busy?
Thanks for checking! Sometimes the "busyness" appears random, but yes the document recovery bar definitely increases the probability!
xlOil is supposed to wait and retry, but I appear to have broken this feature in some cases.... I have a fix now and will let you know when it's deployed.
I've fixed the COM busy retrying logic in v0.16.1, which is now available. Hopefuly this will fix the issue here.
Thanks a lot! I will be testing it!
In the past two weeks, no COM busy related errors have so far appeared on 0.16.1!
Great news! I'll close this, please re-open if the issue re-surfaces.
Using windows 10, python 3.9, Excel 2021, xloil 0.17.17
I am also experiencing a few problems when closing an excel file.
1) my_code.xlsm has only udf Adder()
Save and then close excel. Works
Close excel without prior save. Not working. The pop up asking me if I want to save changes is closed without any action on my side. excel will be restarted in temporary mode when trying to reopen the file
2) my_code.xlsm has udf Adder()
and udf pyClock()
Closing excel ( with or without saving it ). Not working. Hang infinitely and I have to end task using task manager or it closes but on next opening excel will start in temporary mode.
my_code.py
import xloil as xlo
import datetime, asyncio
@xlo.func
def Adder(x, y):
return x + y
@xlo.func
async def pyClock():
while True:
yield datetime.datetime.now()
await asyncio.sleep(10)
Hello Steven, after using the xloil module, Excel will always fail to close the last workbook normally, this is my xloil log(xlOil.log), please help me to see how to solve it, thank you.