Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to run python script inside my load script in Qlik Sense app.
I know that I need to put OverrideScriptSecurity=1 in Settings.ini
I put
Execute py lib://python/getSolution.py 12 'ble';
and I get no error in qlik sense, bu script is not executed (I think) because inside the script I have
f = open("file.xml", "wb")
f.write(xml)
f.close
and file is not saved.
If I run script from terminal, then script is properly executed.
What could go wrong?
Just a question. Did you disable Standard Mode in Qlik Sense Desktop before trying to execute your Python script?
Yes I did.
You were right. If I move script in C:\Windows\test.py it work.
Now I assume that the problem is space in path....
Any thoughts?
Thank you.
Put double-quotes around paths that you want to pass as-they-are (including any spaces) to an external program. Double-quotes will be passed along and won't be interpreted by the script engine in this case.
See this subthread for an explanation: Re: Double quotes on Execute statement
Most of these EXECUTE problems have to do with the fact that the Windows shell can't find the program to execute. Even cmd.exe may require a full path sepcification before it can be found.
Peter Cammaert's answer is most likely the correct one if you get the error message " Error: The handle is invalid."
Even if the execute command runs in QlikView Application on the server the executable may not be in the path for the service account running the qlikview distribution engine.
Check the system Path environment variable in Windows System Properties "Environment Variables"
.
I guess the problem is not with spaces but the directory is not accessible from qlik sense.
This works for me.
I have the following folders/files:
myfolder/qvw/testpython.qvw
myfolder/bin/testpython.qvw
myfolder/data
For QVW:
Go to Settings-->User Preferences-->Security and select the checkbox next to "Script (Allow Database Write and Execute Statements)"
In the load script editor Settings tab, select the checkbox next to "Can Execute External Programs"
QVW Load Script:
I was able to get the below to work in qlik sense:
set vPyExe = C:\Program Files\Python37\python.exe;
set vPyScript = D:\...\PythonScript.py;
Execute
"$(vPyExe)" "$(vSource)"
;