Alteryx Designer

Find answers, ask questions, and share expertise about Alteryx Designer.
Register for the upcoming Live Community Q&A Session - and don't forget to submit your questions for @DeanS regarding the future role of analytics here.
SOLVED

Python tool - %Run command is returning invalid syntax in Production Mode

Highlighted
5 - Atom

HI , 

I am trying to  call a external python script using run command in Python too. 

This command is working  fine in interactive mode but failing with invalid syntax when i switch to production mode and run the workflow .

 

Can i run the workflow from gallery keeping scripts in shared drive ?

 

Appreciate if anyone  has solution to fix this.

interactive Mode 

KKR_Bond_1-1582928452111.png

 

Production mode 

KKR_Bond_2-1582928508595.png

 

Highlighted
Alteryx
Alteryx

Production mode converts your Jupyter Notebook into a Python script that is executed directly against the command line. Thus, Jupyter Magics, such as %run will not work.

 

In the .py file you want to run, I recommend reorganizing your code into a function which you can then call with Alteryx.importPythonModule, where yourFunction() is the function in file.py that you would like to call

py_script = Alteryx.importPythonModule("file.py")

py_script.yourFunction()

 

 

Highlighted
5 - Atom

Thanks AndrewKrammer, I am able  call python script as explained   

Labels