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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
ankit7359
Creator II
Creator II

How to send user input/arguments to a python script

Hi,

I came across a scenario where the required parameters must be sent to python script in talend and the python script is being called by using tsystem component.

What my analysis is -> to store the parameters/user-input in a context and call the context variables in tsystem component.....

Can you pls let me know if this is approach is correct... 

Thanks,

Ankit

Labels (3)
2 Replies
Anonymous
Not applicable

This seems like an entirely reasonable approach. Just keep in mind that when using the tSystem component, you are essentially sending a Java String to the terminal. So when building your command with parameters, think about building a Java String that represents that command. For example....

 

If you are wanting to search a directory for txt files in one run and jpeg files in another, you could parameterise your extension name in a context variable called "fileExtension", then use it in a tSystem like below...

"cmd /c dir *." + context.fileExtension
ankit7359
Creator II
Creator II
Author

I ll give it a try and get back to you on this...
Thanks.