Messages - Tony

you would have to use the 'var' type and do the type conversion yourself (you can use pyxll.get_type_converter('var', 'date') to get the var->date type converter, which would convert a number to a date).

The problem is that the array formula is too long to be set using the Excel API. Unfortunately this is a limitation of Excel, and I'm not sure at the moment if it is something I will be able to work around.

I think your best options are either to reference some of the arguments in cells on the same sheet where the array function is and reference them from there, or maybe shortening the name of the sheet name will be enough. I know this isn't ideal, but it should work.

Best regards,Tony

ps. The array formula maximum length is 255 characters, and your formula is shorter than that so you would think it should work. But, that 255 limit applied after the formula is converted into R1C1 style cell references by Excel, which makes it longer

Unfortunately I've not had a chance to look into PyQt5 so I can't say what other changes might be necessary - but, as long as there's a way to poll its event loop then it should be possible to have a non-blocking window. If you manage to get anywhere please do report back and I'll add your findings to the blog post.

try installing PySide (https://pypi.python.org/pypi/PySide/1.2.4). PySide is a Qt4 wrapper, supported by matplotlib. Note that it doesn't support Qt5, that is being done by the PySide2 project and as far as I know that's still a work in progress.

Since PyXLL 3.3 pyxll.async_call now runs the callback in the main thread in an Excel macro context. This means it is safe to do Excel COM operations like writing back to the sheet without having to code complicated retry logic yourself.

a volatile function is called every time the worksheet is calculated, so setting volatile=True would give you the behaviour you describe and not what you want.

If an argument to a function is volatile then because that argument will be calculated every time the sheet is calculated then the function will be called too, even if the function itself if not volatile. If you have automatic calculation turned on in Excel then changing any cell will cause a recalculation.

Is one of the arguments you are passing to your function =TODAY() or something like that? TODAY is a volatile function, and so if you are using that as an argument then that will be why your function is getting called every time you calculate the sheet.

If you can't avoid passing in the result of a volatile function then I would suggest you cache the result of your function using something like functools.lru_cache to avoid repeating any expensive operations (https://docs.python.org/3/library/functools.html).

you've not mentioned the specific error you're seeing so I can't help with the exact problem you're having I'm afraid.

[edit]Ah, I see the error is actually the subject. That error is staying that you don't have Qt installed. I expect matplotlib is failing to load the Tk backend and trying to fall back to the Qt backend and that's failing too -- the suggestions below to get Tk working should help.[/edit]

If you're using the Tk matplotlib backend (which is the default) you may need to set the Tk/Tcl environment variables, which you can do by adding the following to your pyxll.cfg (with the paths updated to wherever your Python install is):

Usually this is done when Python is installed, but depending on how Python was installed or if you are using a virtualenv it's possible they are set correctly when running your code from Spyder but not when running in Excel.

If you're still having problems after setting these environment variables please could you send me your complete log file with the log level set to 'debug',

after making this code change did you recalculate your workbook and re-save it? Try fully recalculating it by pressing Ctrl+Alt+F9 and then save the workbook. Excel remembers if a function is volatile or not, so if the saved version of your workbook doesn't have the function marked as being volatile it won't recalculate when opened.

The repeated connect/disconnect messages in the log for CurrentTimeRTD are a bug that was fixed in 3.3.2 that affects RTD functions with default arguments (https://www.pyxll.com/changelog.html#pyxll-3-3-2-2018-01-03). Since your function doesn't have any default arguments it's not affected by this bug.

then something is still wrong with your pywin32 installation and it's not anything to do with PyXLL. I'm not sure why deleting those gen_py files wouldn't resolve it, unless something is going wrong when generating them.

I guess seeing as it's a COM issue it could be worth restarting your PC, otherwise I'm not sure what else to suggest that I haven't already I'm afraid.