Alteryx Designer Desktop Discussions

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

Python tool - strange characters being exported

JamesFo
8 - Asteroid

Hi All,

 

I've got a python tool to read a simple amazon product page (I've arbitrarily chosen this printer lead HERE).

 

My Python tool seems to be working fine:

 

JamesFo_0-1583255986090.png

 

JamesFo_1-1583256013780.png

However, when I look at this in the results window, something strange has gone on.

 

JamesFo_2-1583256094796.png

 

Any ideas? Something to do with encoding? Workflow attached.

 

Many thanks,

 

James

 

 

 

 

2 REPLIES 2
PaulN
Alteryx Alumni (Retired)

Hi @JamesFo,

 

Thanks for posting.

 

The result is correct. In your code, you store "r.content" which is an array of bytes (source: https://requests.readthedocs.io/en/master/user/quickstart/#response-content). If you use "r.text" instead, you will obtain a readable text.

 

I have attached an amended version.

 

Hope that helps!

 

Paul Noirel

Sr Customer Support Engineer, Alteryx

JamesFo
8 - Asteroid

@PaulN,

 

Thank you for the solution - I'm a bit perplexed, as I'm sure I had that exact piece of code working before on other websites. Never the less, your solution definitely fixes it!

 

Out of interest, do you know why it shows properly in the python window, while sending the confused characters to Alteryx?

 

JamesFo_0-1583313745793.png

 

Thanks again for the help,

 

James

 

Labels