sure, just give me a minute to find out how to share the clone as I have not done it before. Also, please be informed that the function (def Analytics2) is running from Jupyter Notebook. The function was working fine yesterday. But I am getting this error today!!!
Sorry, that app is the running app. I was looking for a clone of the code (click the and choose the share the code option). But yeah, if the issue is in the notebook, weād need to see that code too (or the chunk that relate to the issue).
I closed and reopened notebook. I still get the same error.
I used the exact same inputs in notebook and in anvil app. The code runs perfectly fine in the notebook. However, with the same inputs from anvil app I get the above error.
I also tried amending the code in anvil to:
start_date = str(self.date_picker_from.date)
end_date = str(self.date_picker_to.date)
then I got the following error:
IndexError: single positional indexer is out-of-bounds
Wierd. Itās as if thereās another definition of Analytics2 marked as @anvil.server.callable, somewhere in your code. If there is more than one, then only the one registered last (most-recently) will be called.
what do you mean by this?
I think @p.colbert suggestion might be correct here -
If the call signature still has 8 positional arguments and youāre only sending 6 positional arguments to the function - then I think this must be the problem no?
from what I understand
# Client side
anvil.server.call('Analytics2', asset_id,
benchmark_id,
risk_free_daily,
required_return_daily,
start_date,
end_date)
# Server Side
@anvil.server.callable
def Analytics2 (asset_type,
asset_id,
benchmark_type,
benchmark_id,
risk_free_daily,
required_return_daily,
start_date,
end_date):
Hi, I found were the problem is by investigating the data sent from Anvil client to the notebook. However, I would be grateful of your help to resolve it.
I have 5 inputs for asset_id (see below) which the code in notebook iterates over them in a āfor loopā. If I input all the 5 asset_id in the respected anvil app text_boxes the code works perfectly well. However, if one of the asset_id text_boxes is empty the code gives an error.
Ok⦠Anvil will transmit that tuple as a list, so you may as well convert it into a list to work with. That makes it mutable; that is we can modify it in-place. Something like the following should work:
asset_id_list = list(asset_id)
while None in asset_id_list:
asset_id_list.remove(None)
Then you can pass asset_id_list in place of asset_id in the call to Analytics2.
Glad to hear you solved the problem! In order to help other users find solutions quickly, you can mark questions as āsolvedā by clicking the below the post.