Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Ganshyam
Creator II
Creator II

Calling Python Script using tsystem component.

Hello ,

I am using tsystem component to call the python script.

In tsystem component : 

"/bin/bash"

"-c"

"python3 /path_where_py_is_placed/test.py"

Is this the correct way to call the python script in tsystem component ?

 

Labels (1)
  • v8.x

5 Replies
Shicong_Hong
Employee
Employee

Hello 

Any error are you getting? If Can't find Python executable "python3", ensure the Python paths are in the user's (not the system) PATH environmental variable. This article might help you.

https://community.qlik.com/t5/Official-Support-Articles/Unable-to-execute-Python-script-with-tSystem...

Regards

Shicong

jlolling
Creator III
Creator III

Actually the tSystem component wants all parts of the command in a separate line in the comment setting.

You should place the path to the python script also to a separate line.

You do not need "/bin/bash" and "-c". Simply call it this way:

"python3"

"/path_where_py_is_placed/test.py".

The explicite call of bash or any other shell interpreter is only needed if you want to use command only provided by the shell. Most other commands like ls are binary commands and do not need an explicite shell.

Ganshyam
Creator II
Creator II
Author

Hi Jlolling,

Tried  removing the  "/bin/bash" and "-c" , and putting

"python3"

"/path_where_py_is_placed/test.py" separately.

but getting error : Cannot run program "python3" error=2 No such file or directory.

jlolling
Creator III
Creator III

In this case you have to use the full path to the python3 interpreter.
jlolling
Creator III
Creator III

Or instead of using the full path to python3 you can also take care python3 is path of the PATH environment variable. Check this by calling python3 just from any arbitrary folder.