The Python Tool is throwing a RuntimeError if a input table to the Alteryx.read() function contains no rows.
The error shown is:
Error: unable to read input table "4460abb7be83bae8f01b9bf1238a923c" (C:\Users\...
I've created a workaround by inputting the column names separately, catching the error, and exporting an empty Pandas DataFrame, but the Alteryx.read() function should handle tables with no rows by creating an empty Pandas DataFrame directly.
The implementation is part of a Macro and I can't guarantee they will always be rows received.
Had anyone else encountered this problem?
Hello @braggis ,
I experience an error when no data is passed to the python tool.
As another workaround, you can add a record count with the RecordCount tool with an AppendField to be sure that you push every time a data frame with values inside.
(If this post helps, then please consider Accept it as the solution to help the other members find it more quickly).
Hi @WilliamR
cc: @BlytheE
I battled with this exact error today too!
Is there a fix on the roadmap for this? It seems like the desired behavior would be for the Alteryx.Read to return a dataframe with columns but no rows rather than throwing an error that cannot be managed?
it is possible to put the Alteryx.read('#1') into a try-except block - but if it throws an error you just don't know if the error was caused by a missing connection; a failure of the Alteryx library or an empty record-set (which should not be a terminal error condition)! Doesn't make sense for every user to have to work around this by putting a count tool in front of every python tool just to make sure it doesn't fail because of an empty recordset coming into the input.
If it helps - I'm happy to log an idea for this?
Thanks @WilliamR
Sean
Hey Alteryx team, no updates on this? I agree with @SeanAdams it makes no sense at all
Hi, checking to see if there was any update on this? Facing the same issue. A fix for this will be great! Thanks.
Hi, just to share the simple workaround that is working for me until this is fixed, i am uniting a text input with null data and filtering out this row inside the python tool.
Checking on this myself.. At least for my use-case there will be some data somewhere, so I'll just use try/except to concatenate incoming lines.
User | Count |
---|---|
19 | |
15 | |
15 | |
9 | |
8 |