Alteryx Designer Desktop Discussions

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

Python Tool Error

Jmann3891
6 - Meteoroid

I am working with the Python tool and keep receiving and keep receiving the following error. I believe the string is tool long, but I am not sure. The goal is to read in a file path in a batch macro. Any help would be appreciated. 

 

Error: 

 

OSError: [Errno 22] Invalid argument: '                                                   \n  C:\\Users\\*****\\Desktop\\New folder\\Trade Confir...'

Code: 

 

FP= Alteryx.read("#1")
FP.rename(columns={"F1":""}, inplace=True)
FP.rename(index={0:""}, inplace= True)
FP=r'{}'.format(FP) 

text = convert_pdf_to_txt(FP)

2 REPLIES 2
Jmann3891
6 - Meteoroid

UPDATE:  

I updated the code and it stripped away all the white space prior to the file path but it is still replacing my file path with periods at the end.  It makes sense the file is not found since the files name is trade confirm 1. 

 

FP= Alteryx.read("#1")
FP.rename(columns={"F1":""}, inplace=True)
FP.rename(index={0:""}, inplace= True)
FP=r'{}'.format(FP)
FP1=str.strip(FP)

text = convert_pdf_to_txt(FP1)

 

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\*****\\Desktop\\New folder\\Trade Confir...'

 

Jmann3891
6 - Meteoroid

Bump.

Labels