Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.
SOLVED

Is Int64 not supported by the Python Tool Alteryx.write(df,1)?

cam_w
11 - Bolide

The enumerate() function defaulted the index value to Int64, but the Alteryx.write() function appears to have a problem with this value:

 

Error: Python (1): ---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-10-6920c2458fa4> in <module>
    105     dfOutput = pd.DataFrame(file_list, columns=['File Number','File Name','File Data'])
    106 
--> 107 Alteryx.write(dfOutput, 1)
c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\ayx\export.py in write(pandas_df, outgoing_connection_number, columns, batch_size, debug, **kwargs)
     97         columns=columns,
     98         batch_size=batch_size,
---> 99         **kwargs
    100     )
    101 
c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\ayx\CachedData.py in write(self, pandas_df, outgoing_connection_number, batch_size, columns)
    500                     "data",
    501                     metadata=write_metadata,
--> 502                     batch_size=batch_size,
    503                 )
    504                 # print success message
c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\ayx\Datafiles.py in writeData(self, pandas_df, table, metadata, batch_size)
    754 
    755                         if batch_size == 1:
--> 756                             self.connection.append_record(row)
    757                         else:
    758                             if rows_i == 0:
TypeError: No registered converter was able to extract a C++ pointer to type char from this Python object of type int

 

 

Do we need to convert all int64s to strings first each time?

 

2 REPLIES 2
cam_w
11 - Bolide

'Casting' the int64 to str didn't remove the error:

 

dfOutput['File Number'] = dfOutput['File Number'].apply(str)

 

The second Alteryx.write(df, 2) doesn't have this problem and it's all strings. Something suspicious ...

cam_w
11 - Bolide

Having some experience with some other tools getting 'stuck', I decided to try removing the Python tool and starting again. Here are my steps:

 

  1. Switch to Production tab, and copy all the python code into a text file.
  2. Delete the Python tool from the canvas. Save and close the workflow.
  3. I closed Alteryx completely, but it might work without needing to close the whole app.
  4. I rebooted, but it might work without rebooting.
  5. Restart Alteryx and load the workflow.
  6. Ran the workflow without the Python tool to initiated the data connectors.
  7. Add the Python tool back, and reconnected the input and ouptut connectors.
  8. Copied and pasted the python code back into the notebook.
  9. Run the workflow with the python tool.

No issues with the Python tool after removing it and recreating it with the exact same code. So that's good to know!

 

I think I must have just over worked it with my testing of the code in the notebook and the whole thing needed to be recreated. Hopefully this helps others get quick resolution in similar situations.