Alteryx Designer Desktop Discussions

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

Command Tool - dynamic path in Python code

kasiuga
5 - Atom

Hi,

I am using Python code in Alteryx in Command Tool. And it is working properly. 

I python I have some paths to different folders, files etc. Bacause I am writing the code on my local machine, then I am testing in on sandbox server and next it is depoly on prod, I have to change those paths manualy. So I decided to create json file with all path on every server. The path to json is dynamic. 

And when I run python code on sandbox, it works. But when I run the same code in Alteryx I have: error code 1. I know that it has a problem with this dynamic json\config path. Do you know, what should I change to have correcly working Alteryx?

 

My code in python looks:

 

config_path = Path(os.path.json(str(Path.cwd(), "Config\\config.json"))

with open(config_path) as f:

        config = json.load(f)

 

in json I have path in dictionary like:

{"lod_path": "C:\\desktop\\log"}

 

I have double \\ because with single it doesn't work.

0 REPLIES 0
Labels