Alteryx Designer Desktop Discussions

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

Configuration of libraries between Jupyter/Alteryx and internally developed tool

bbznyc
6 - Meteoroid

Hello Alteryx/Python guru's...

 

This is my first post so please don't roast me :)  Here is the question applicable to Alteryx 2018.3:

 

In my company, there is an internally developed tool which has a python interface as an option and is installed in a standalone directory.  I am looking to use Alteryx Python to call functions within the internally developed tool.  Here is what needs to be impeded in the beginning of the script:

 

What do I need to modify here to run the script through Alteryx?

 

All the help is appreciated.  Thank you.

 

Note: please change the environment variable PATH (LD_LIBRARY_PATH for Unix/Linux) and PYTHONPATH to include the extracted directory (DBADIR).
This will allow your Python code to be resided in any directory and still use the correct library.
You can also include the following code at the beginning of your Python Script:

import sys
import os.path
if sys.platform[:3] == "sun" or sys.platform[:5] == "linux":
	newDirs = os.path.expandvars("$LD_LIBRARY_PATH");
	for loop in newDirs.split(":"):
		sys.path.append(loop)
else:
	newDirs = os.path.expandvars("$PATH");
	for loop in newDirs.split(";"):
		sys.path.append(loop)
4 REPLIES 4
Claje
14 - Magnetar

Hi,

I'm not amazing at python, but I think you can just include that code in your Python tool and it should work without error.

Do you encounter errors trying to use this and then call functions inside the internal tool?

Claje
14 - Magnetar

One more note - the code (as pasted) uses tabs within python for things like the loop.  The jupyter workbook inside of Alteryx defaults to four spaces when you manually enter a "tab" character.  However, when I copied this code into the Alteryx jupyter workbook, the tab characters were maintained in the existing structure.  Since Python wants tabs OR spaces, but not both, I would recommend changing these tab characters to spaces for ease of use and consistency.

DiganP
Alteryx Alumni (Retired)

@bbznyc I agree with @Claje. The code seems to be right, just make sure that the tabs/spaces are correct for the loop. You might just have to replace LD_LIBRARY_PATH to path for Unix/Linux and PYTHON PATH in your environment variables (different location, outside of alteryx).

Digan
Alteryx
bbznyc
6 - Meteoroid

Hi Everyone,

 

Thank you for the responses.  I am currently working with the team that developed Python interface to configure it within Alteryx.

 

Will keep posted on the success/failure of this.

 

Thanks again,

B

Labels