On 2 August 2017 at 23:57, Nick Coghlan <ncogh...@gmail.com> wrote: > Another variant of that idea would be to have the default handler be > something like Geoffrey Thomas's pythonmux project > (https://github.com/geofft/pythonmux), and then patch > sys.excepthandler to report the Python version executed when > "sys.executable" isn't qualified as either Python 2 or Python 3 for > easier debugging of otherwise potentially cryptic error messages. > > If we did do that, then I'd skip the "pyversions" comment idea, and > instead have the logic just be: > > - if only /usr/bin/python2 is present, use it > - if only /usr/bin/python3 is present, use it > - if both are present, use /usr/bin/python2
While I'm happy I at least brought it up, I still can't convince myself to actually *like* this idea relative to the "compile it and report on the results" approach combined with the ability to opt-in to replacing that default script with a symlink to the desired version. This is due to what happens in a situation like Fedora's with various mux behaviours: = Approach 1: impllcitly try Py3 = All the same problems as a plain symlink. If we were to patch sys.excepthandler() to report the version when sys.executable == '/usr/bin/python', then that UX tweak would apply just as well to the symlink switching approach (maybe I should propose that as an *upstream* change, and check for '/usr/local/bin/python' as well?). = Approach 2: default to Py2, complain if it is missing = Same effective consequence as defaulting to a custom script that checks for Py3 syntax compatibility, just with a different more implicit remedy ("Install Py2" vs "Install Py2 & make it the default Python"). Also has the downside that you can't opt-in to making Py3 the default instead. = Approach 3: add a magic script comment to opt-in to trying Py3 = This whole problem just doesn't feel like a per-script setting to me - it feels like a system administrator setting, where they say either "Yes, I am confident in my ability to debug errors arising from myself and others trying to run Python 2 scripts on Python 3", or "I want to preserve compatibility with older Py2 only systems for now, even if that means running parallel Python stacks on my newer systems". Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Linux-sig mailing list Linux-sig@python.org https://mail.python.org/mailman/listinfo/linux-sig