Skip to content

UDF formula is erased on return #1010

@Colin-b

Description

@Colin-b

OS (e.g. Windows 10 or macOS Sierra)

Windows 7 64

Versions of xlwings, Excel and Python (e.g. 0.11.8, Office 365, Python 3.7)

xlwings 0.15.1. Office 365, Python 3.6.5

Describe your issue (incl. Traceback!)

Formula is erased sometimes when sending a call while another one is in progress.
I did not really dig deep but I am able to reproduce by calling either one of the provided UDF.
Steps to reproduce for each formula are in comment, try to have the int parameter in another cell and increment the value as fast as possible to reproduce the issue.

I let you chose which one to use for your testing :)

As you would guess this issue is kinda critical, if you need some help investigating I will be happy to try to find some time :)

Include a minimal code sample to reproduce the issue (and attach a sample workbook if required!)

No specific workbook settings.

import xlwings as xw
import time


@xw.func(async_mode='threading')
@xw.arg('behavior', numbers=int)
@xw.ret(expand='table')
def formula_erased_1(behavior):
    # Call 1 then as soon as you can call 2, then 3, then 4, bug will occur when you will be able to hit enter multiple time but Excel still hasnt processed your ENTER press
    time.sleep(5)
    if behavior == 1:
        return [['value'] * 20] * 61200
    return []


@xw.func(async_mode='threading')
@xw.arg('behavior', numbers=int)
@xw.ret(expand='table')
def formula_erased_2(behavior):
    # Call 1 then as soon as you can call 2, then 3 -- Formula will disapear as you will call 3 before 2 even returned
    if behavior == 1:
        return [['value'] * 20] * 300
    if behavior == 2:
        time.sleep(20)
        return [['value'] * 20] * 250
    return [['value'] * 20] * 200

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions