Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTD delay and first RTD does not trigger any event calculate #124

Open
ShieldTrade opened this issue Dec 16, 2024 · 1 comment
Open

RTD delay and first RTD does not trigger any event calculate #124

ShieldTrade opened this issue Dec 16, 2024 · 1 comment

Comments

@ShieldTrade
Copy link

ShieldTrade commented Dec 16, 2024

xloil 0.18.7
Excel 64

I experience a delay in pyclock ( random from 50 to 150 mls ) and, when the first yield is received in excel, the event calculate is not fired. Following yields normally trigger the event calculate.

sheet1
G10 = pyclock (10)
for cell G11 and G12 change format and use custom format hh.mm:ss.000

sheet 2
C10 = Sheet1!G11+Sheet1!G12+1

Save, close, reopen and press F9.

This is part of a more difficult issue that I am trying to debug where the event calculate triggers a macro ( I use VBA ) which copies the data received in another sheet of the same workbook. It works fine for a random time ( usually from 5 to 24 hrs ) then excel crashes and nothing is printed in the xloil log. The task manager does not show any problem for memory and cpu usage. Before copying I disable events and set calculation to manual. I suppose a thread conflict is the cause but I do not see any in my code. I am deconstructing and testing small part of it.


import xloil, datetime, asyncio
import pandas as pd

@xlo.func
async def pyclock (secs):
    while True:
        data_df = { 'time': [], 'event': [] }
        time = datetime.datetime.now()
        data_df['time'].append(time)
        data_df['event'].append('data received')
        data_df['time'].append(time)
        data_df['event'].append('data received')
        df = pd.DataFrame(data_df)
        df = df.set_index('time')
        yield df
        await asyncio.sleep(secs)`

VBA code in sheet 2
Option Explicit
Private Sub Worksheet_Calculate()
     MsgBox "  calculate sheet 2"
End Sub

@ShieldTrade
Copy link
Author

Update

Whenever you change something in python and the reload module is called, the first yield does not trigger the event calculate.

Happy Christmas to @cunnane and to all xloil community!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant