Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Python Tool throws RuntimeError on Alteryx.read() if there are no rows

braggis
6 - Meteoroid

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?

6 REPLIES 6
WilliamR
Alteryx
Alteryx

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).

 

 

SeanAdams
17 - Castor
17 - Castor

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

 

Thableaus
17 - Castor
17 - Castor

Hey Alteryx team, no updates on this? I agree with @SeanAdams it makes no sense at all

jineshnp31
8 - Asteroid

Hi, checking to see if there was any update on this? Facing the same issue. A fix for this will be great! Thanks.

Felipe_Ribeir0
16 - Nebula

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.

 

Felipe_Ribeir0_0-1665405410405.png

 

TimPowers
7 - Meteor

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.

Labels
Top Solution Authors