remisalmon / gpx-interpolate

Python function to interpolate GPX data using piecewise cubic Hermite splines
MIT License
49 stars 12 forks source link

Script fails to run when default Python is python2 #13

Closed willvousden closed 2 years ago

willvousden commented 2 years ago

The shebang is /usr/bin/env python, and on my machine (macOS) this resolves to python2. Can be solved by using /usr/bin/env python3 instead.

remisalmon commented 2 years ago

Hey @willvousden use macports/brew/conda on MacOS to install Python 3 and set it as your default python in your env, Python 2 has been deprecated for some time: https://www.python.org/doc/sunset-python-2/

willvousden commented 2 years ago

@remisalmon I already use Python 3 from Homebrew for all of my Python development and have done for years. The problem is that python in macOS resolves to the one shipped with the OS, which is still Python 2.7:

$ which python
/usr/bin/python
$ /usr/bin/python -V
Python 2.7.18

This is a known problem with macOS and as far as I know you cannot have /usr/bin/env python resolve to anything other than /usr/bin/python without potentially breaking things (see this SO post). So there's very little that macOS users can do about this (although I'm happy to be proved wrong).

Either way, I'd ask you to consider simply changing the shebang to use python3 explicitly, as this will make the script work on basically every platform out-of-the-box, regardless of which version of Python is the default.