On an Enterprise server that has multiple versions of Python installed, we’re getting an error when trying to run some Python 3 processes. The suspicion is that Panorama and Python 3 are running in different shells and that Panorama is calling to the wrong version of Python for our purposes here.
Is there a way to specify the version of Python that a script refers to?
FYI, the source code for the PYTHON statement is viewable (and even editable). In Panorama 6 that is done with the Custom Statements wizard, PYTHON is in _ScriptLib.
Additional note: None of this has anything to do with what shell is being used. DIfferent shells could have different search path’s for finding shell commands, but since Panorama is explicitly specifying the exact path to use, the search path preference doesn’t matter. It could matter if you were manually invoking a command from Terminal.app.
Panorama is not pointing to the right version of Python as 3.9 is not in /usr/bin/, but I can’t find _ScriptLib in any installation of Panorama 6. Can you (or anybody) send me a copy please?
I actually wasn’t suggesting changing _UtilityLib, but that’s pretty safe to do since ProVUE will never be publishing another version of Panorama 6. The change is different than the code I posted above but I don’t think you’ll have any problem figuring it out.
I don’t know how on earth I got two quotes in there, that was a mistake on my part. I have gone back and edited the post above.
But as I said – DO NOT use that code when editing the PYTHON procedure in _UtilityLib. Instead, find where the code is that sets up the pythonPrefixLineTemplate variable and change it there. Here’s the line you want to change:
Well I’m not a shell expert or a Python export. You now have the keys to control the horizontal and the vertical, so I’ll leave it to you. Let us know if you figure it out.
We were able to reliably run the script through Python 3 via Terminal but could never get Pan 6 to do it. Possibly it was our failure to put it together properly but what worked in Terminal didn’t work as a shell script in Panorama. Eventually we ended up saving the Python script to disk, then having AppleScript run it and that’s working.
Well for what it’s worth – that’s exactly what Panorama does to run Python scripts! Except are you saying that your AppleScript somehow opens Terminal.app and runs it there? Panorama uses the AppleScript do shell script command, which is built into AppleScript.