Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Tony

Pages: 1 [2] 3 4 ... 39
16
Help and Support / Re: Error opening COM addin
« on: April 10, 2017, 10:50:12 AM »
Hi,

one thing that might cause this error was if for some reason Excel had disabled the PyXLL COM Addin (PyXLL is actually two addins in one - the plain xll that does all the worksheet functions and menus, and a COM addin that does the ribbon and RTD).

Please can you check your disabled addins by going to Options -> Add-Ins -> Manage Disabled Items (in the "Manage" drop down at the bottom of the addins panel). If PyXLL is in there try enabling it and see if that resolves this error.

Best regards,
Tony

17
Help and Support / Re: Error opening COM addin
« on: April 10, 2017, 09:53:42 AM »
Hi,

when you start Excel, those are not errors - they are just debug messages. They are normal. The Excel COM API isn't available when Excel first starts, so PyXLL keeps retrying periodically until it becomes available.

The error code you're getting when reloading corresponds to the error "E_ABORT". This is usually returned because some operation has been cancelled (e.g. by the user pressing Esc in the middle of some calculation, or Excel is busy doing something else). How are you reloading PyxLL (i.e. using the Python reload function, or via the ribbon etc)? Is there anything else going on at the same time? (e.g. do you have anything using the Excel COM API or any VBA code running that could be causing a conflict?).

Do you get this error every time you reload PyXLL, or just sometimes?

Best regards,
Tony

18
Hi Alfredo,

I'm pretty sure I've got to the bottom of this now. I've uploaded another build to the beta site

https://beta.pyxll.com/download.html
username: pyxll
password: pyxll

This build should fix the issues you've been having both with async_call and with auto resizing array functions.

Apologies it's taken a while to get you a fix for this. It was a pretty subtle problem that proved to be very hard to track down.

Please let me know once you've had a chance to try this, and if it's all good I'll get the next (non-beta) release prepared.

Best regards,
Tony

19
Hi Alfredo,

hold off testing this for now... I'm looking into it some more...

thanks,
Tony

20
I just uploaded another build to the beta site - I found an issue with the changes I made and the pop-up that appears if the license key is invalid. It shouldn't affect you, but thought I'd let you know anyway.

Best regards,
Tony

21
Hi Alfredo,

I've uploaded a new beta build:

https://beta.pyxll.com/download.html
username: pyxll
password: pyxll

I wasn't able to recreate exactly the problem you described, but I did find a potential cause for it - and this build fixes that. This should fix any problems with switching windows while auto-resizing arrays are being processed, and although I couldn't verify it, I hope it will also fix your problem with using async_call.

Please could you try it out and let me know?

Kind regards,
Tony


22
Hi Alfredo,

I've had a bit of a breakthough and think I now know what's causing the problem.

I should have new build for you to test either later today or tomorrow.

Best regards,
Tony

23
Hi Alfredo,

I'll try to reproduce the issue with Excel 2010 and 2013 too. Hopefully I will have more luck with those and will be able to find a work around.

Best regards,
Tony

24
Hi Alfredo,

I've been trying to reproduce this problem with your latest spreadsheet, but so far I've not been able to I'm afraid :(

I tried modifying your sheet so that the calculations were chained, as before, but that worked fine for me too. To try and make it fail I did a lot of clicking around and modifying cells (including the input cell A6) while it was still calculating, but I couldn't make it crash or freeze.

I've attached my worksheet and the function used, but neither this nor your original sheet failed for me :(

I wonder if it's something that's been fixed in an update to Excel, and I'm using a more recent version? I've been testing using Excel 2016 version 1609, build 7369.2120. You can check your version under 'product information' on the right hand side of the account screen in Excel. If your version is older, try getting the latest version and see if that makes any difference.

Best regards,
Tony


25
Ok thanks - I will continue to investigate

26
Hi Alfredo,

hmm that's odd, the following code worked for me:

Code: [Select]
@xl_func(macro=True)
def automation_example(rows, cols, value):
    """copies value to a range of rows x cols below the calling cell"""
    # get the address of the calling cell using xlfCaller
    caller = pyxll.xlfCaller()
    address = caller.address

    # the update is done asynchronously so as not to block some
    # versions of Excel by updating the worksheet from a worksheet function
    def update_func():
        xl = xl_app()

        from win32com.client import constants
        if xl.CalculationState != constants.xlDone:
            print("Still calculating...")
            return

        range = xl.Range(address)

        # get the cell below and expand it to rows x cols
        range = xl.Range(range.Resize(2, 1), range.Resize(rows+1, cols))

        # and set the range's value
        range.Value = value

    # kick off the asynchronous call the update function
    pyxll.async_call(update_func)

    return address

Is that the same as what you were trying?

thanks,
Tony

27
Hi Alfredo,

I think the problem is that the callback is being called while Excel is still calculating... I'll see if I can put something into async_call to defer calling the callback until the calculation is fully complete, and I think that will fix it.

You can try adding this check:

        from win32com.client import constants
        if xl.CalculationState != constants.xlDone:
            print("Still calculating...")
            return

If you add that, I think it will fix the problem.. but note that you shouldn't call async_call again there as that will result in a tight loop that will look like Excel's freezing (but it will just be busy processing and re-queuing all those callbacks!)

Let me know if that helps, and I'll let you know once I've had a chance to look at doing something to async_call to try and deal with this case.

Best regards,
Tony

28
Hi Alfredo,

that's great! :) I can get a new release done pretty quickly (I just need to do some more testing myself and make sure the docs are up to date). I'll aim to have it done before the end of next week, but if you need something sooner than that let me know and I will try to expedite the process.

Kind regards,
Tony

29
Help and Support / Re: activating addinn
« on: March 29, 2017, 02:50:11 PM »
Hi,

that can happen if you are trying to use the 64 bit version of PyXLL and Python with the 32 bit version of Excel, or vice versa.

You will need to install a 64 bit version of Excel if you are using 64 bit Python (or you can switch to a 32 bit version of Python if you prefer, so long as Python, PyXLL and Excel all match!).

Best regards,
Tony

30
Hi Alfredo,

yes, I have been looking at this issue :)

I found that it would sometimes cause Excel to freeze, and sometimes it would work fine. From what I can tell, this is an occasional problem with calling the Excel COM API from a background thread in the Excel process. I can't think of any reason why this should be more noticeable in PyXLL 3 vs 2... the only thing I can think is that now the xl_app/get_active_object functions work slightly differently and are more robust, previously they may have failed before this freeze could occur.

Anyway, I have uploaded a new beta version for you to try to:

https://beta.pyxll.com/download.html
username: pyxll
password: pyxll

This changes the behaviour of async_call so that rather than schedule the call on a background thread, the call is scheduled on Excel's main thread. Your callback will still be called after the function calling async_call has completed and once Excel has completed calculating, so the usage of this function remains the same but the problem with Excel freezing should be resolved (and was in my testing!).

Please let me know if this solves your problem or not!

Kind regards,
Tony

Pages: 1 [2] 3 4 ... 39