Alteryx Designer Desktop Discussions

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

Output not generated using python tool

alt_tush
9 - Comet

Hi,

 

I am new to python tool.

 

I have written a simple python code in python tool and try to run the workflow but its not generate the .txt output file.

Could you please help me on this. 

 

f = open("D:\Python\demofile2.txt", "x")
f.write("Now the file has more content!")
f.close()

#open and read the file after the appending:
f = open("D:\Python\demofile2.txt", "r")
print(f.read())

 

Please note above code is executed if i saved it in .py file like test.py and executed using command prompt

D:\Python> python test.py  ----- (Its generated the output successfully)

 

Could you please help me why the same is not working if i use the Alteryx Python tool.

 

Thank you in advance,

 

Thank you in advance,

6 REPLIES 6
RuchikaMangla
8 - Asteroid

Hi @alt_tush 

 

Below code ran successfully for me. Slight modification - replaced single back slash with double backslash. make sure, you remove demofile2.txt from D:\Python\ folder.

 

f = open("D:\\Python\\demofile2.txt", "x")
f.write("Now the file has more content!")
f.close()

#open and read the file after the appending:
f = open("D:\\Python\\demofile2.txt", "r")
print(f.read())

 

Let me know if this helps...

alt_tush
9 - Comet

Hi RuchikaMangla,

 

Thank you for your quick response. As you suggested i made the changes in code (double blackslash) and re-run the workflow.

But still the output is not generated. Also i have removed "demofile2.txt" file from folder before run the workflow.

 

Also for information i am using Alteryx 2019.1.6 version.

 

Thanks again!

RuchikaMangla
8 - Asteroid

Hi @alt_tush 

 

is there any error message you are getting? Could you please share the workflow?

 

Thanks!

alt_tush
9 - Comet

Hi RuchikaMangala,

 

Thank you for replying.

I cant share the workflow.

But here I am sharing the images with you.

I hope it will helpful.

Also I don't get any error message.

Workflow running successfully but not generate the output.

 

Thank you again

 

 

danilang
19 - Altair
19 - Altair

hi @alt_tush 

 

Try the attached.  It worked for me. 

danilang_0-1619695379446.png

 

I didn't know what you had in the Text Input tool, so I just added a dummy field

 

Dan

alt_tush
9 - Comet

HI danilang,

 

Thank you for your reply.

 

Yes in text input i have added only dummy value/filed for incoming connection only.

 

I dont know why the python tool not executing the simple code.

 

I tried your attached workflow as well but i am facing same issue. (File is not generating)

 

Thank you!

 

 

Labels