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?
Solved! Go to Solution.
'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 ...
Having some experience with some other tools getting 'stuck', I decided to try removing the Python tool and starting again. Here are my steps:
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.