community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Parsing Text From PDF Documents with Python Code Tool

Alteryx
Alteryx

Hi @fgilbonio,

 

I think that your path is incorrect and needs to be types with / instead of \ in your python Code.

 

//Mac/Some Folder/Alteryx/foo.pdf

One of the approaches you can use to read the path of file supplied as connection #1 to your Python tool could look like this:

 

 

#Read the path to of ZIP
df = Alteryx.read("#1")

# Load the params from the input
path = "" #Placeholder for folder with a script

for index, row in df.iterrows():
    path = row[0].replace("\\","/")

print(path)

 

 

In path variable you will then have the file path loaded a fixed of your issue, i.e. replaced \\ with / which Python needs.

 

Just supply the path variable to the code where originally I used a constant value.

 

If you want to check out how to build that workflow, I used the control param + text tool for instance in this article

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Reading-Multiple-Files-Of-Your-Choice-...

rather than using ACTION tools.

 

Note: Sorry, can't open your zips for security purposes.

David Matyas
Sales Engineer
Alteryx
Labels