Python and OS 12

Apple has followed through on their ‘promises’ to eliminate Python from inclusion with the OS. With 12.3.1 it is no longer a ready to use part of the OS.

Panorama procedures that use Python now return an error.

I have installed Python 3 but have not yet gotten it working - at least not as desired. I have not put a lot into it so far either, but will plan to share any lessons here. Hopefully anyone else installing Python 3 and configuring it and Panorama X to work together will do the same.

One good laugh to start it off is the progress bar that came up when I downloaded the installation:
Screen Shot 2022-05-09 at 5.29.49 PM

I am hoping that the Python error will be resolved with the next version similar to PHP having essentially the same problem.
See PHP command not found

Similarly, I’m now getting: PYTHON ERROR: sh: python: command not found

I now have Python 3 installed (but I’m not ready to swear it’s all just right). Previously, in order to check the version via Terminal, you’d enter python -version. On 12.3.1 that gets a response that the command was not found. Now I have to enter it as python3 - version and I do get a response.

At some point I believe Panorama will need to address it similarly. A procedure starting with python3 |||… is an unknown statement.

A moving target is the nature of the beast and we’re leaning on Jim to aim on our behalf.

That point will be when b26 is released, which should be pretty soon. You can read about it now. It’s too bad that macOS no longer includes these languages by default, but I think starting with b26 Panorama makes the best of this situation.

Your aim is pretty good, Jim. :sunglasses:

The Help file for Scripting Language Configuration states that Panorama X will look in the default location for a Homebrew installation, ie.

/opt/homebrew/bin/

I thought I was needing to install Python but I did find it already at the above location. I used the Custom Configuration box to type

/opt/homebrew/bin/python3.9

and Panorama then immediately updated the Scripting Languages section with the installed Python 3.9.18 and its path.

@RAmeeti, I’m not sure if you have a question or not. I’m thinking maybe you are wondering why you had to set up the custom configuration even though your copy of Python was inside the hombrew folder?

Your copy of Python is inside the home-brew folder, but that doesn’t mean that Panorama can find it anywhere inside that folder. I don’t think python3.9 is the default location, I think that would simply be python. Since you have it in a custom location, you had to use the Custom Configuration box to set it up. That’s what this box is for.

Python3.9 is a file, it is not a directory.

This was largely a bug report. It was not working as the docs stated it would given that this was a standard install using the defaults of the Homebrew installation pkg.

3 options:

  1. Remove the statement that it will automatically be found if it is a standard install.

  2. Update the algorithm to filter out numbers and periods and then look for Python.

  3. Do nothing.

I’m good. Just trying to help the next guy.

the documentation states that Panorama would automatically look in the /bin directory for the Python language and it is currently missing recognizing it.

The documentation states that it will find it if it is “in the default installation location”. That doesn’t mean “somewhere inside the folder, I’ll search for it” - that means that it is at the standard path for that language. For Python, Panorama considers the standard Homebrew installation path to be:

/opt/homebrew/bin/python

Your copy of Python is NOT at the standard installation path, it’s in a custom path. So you had to use the Custom Configuration box. That’s why it’s there.

If you think about it, Panorama couldn’t possibly search for Python “somewhere inside the /homebrew/bin” folder. You might have 5 copies of Python in there - which one would it pick?

And as it turns out “which Python to pick” is a fraught topic. Note that above I said “Panorama considers the standard Homebrew installation path to be”, not simply “the standard Homebrew installation path is”. That’s because currently, the homebrew standard Python installation path is not what I said before, but actually:

/opt/homebrew/bin/python3

To understand this difference requires a bit of history. For years, Panorama’s python statement worked with the built in copy of Python supplied by Apple. But Apple NEVER shipped Python 3, only Python 2.7. Ultimately, they stopped installing Python altogether without ever shipping Python 3.

Because of this it’s most likely that anyone that has included Python code in their Panorama applications was using Python 2.7. So Panorama currently doesn’t default to Python 3 - you have to customize the configuration to use Python 3. Since Python 2.7 support ended 6 years ago, maybe it’s time to change that. However, perhaps it’s still best that, for now, you have to make an active choice to decide what version of Python you are going to use. (Note that this 2.7/3 issue has roiled the Python community for nearly two decades, this isn’t a problem that is unique to Panorama.)