Python Forum
run my script in a spefic version or any later one
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
run my script in a spefic version or any later one
#8
(Oct-25-2019, 04:08 PM)Gribouillis Wrote:
Skaperen Wrote:i have a snippet of code i sometimes insert into the beginning of scripts that checks for the minimum version needed and looks around for a usable version and reruns itself with that engine.

In an old python2 project, I used a custom interpreter and my shebang line was #!/usr/local/bin/chathon. This file was a symlink to a file named chathon.py which would select a python interpreter known as ~/.chabei-apps/chabeibox/bin/python, create a custom environment and launch a subprocess with this interpreter and the correct input, output and error streams.

i remember dabbling around with some code like that. it should work. the problem is that the end user would have to install that setup before it could be used. what i would want is to do that on systems where no such effort had been made. it's too late to work in existing systems by installing a single file. but, if the setup of symlinks will include the symlinks for "this version or later" from now on, future cases can be handled. i want to handle situations where the sysadmin is behind because that is where the warning is needed.

i don't know if it is python itself or the OS packaging that sets up these symlinks. but there is generally an OS package for each minor version of python. the scheme i envision would be done there.

the name i am thinking of now for the symlinks is like /usr/bin/python3.3+ -> python3.8 (chaining through /usr/bin/python3.8 -> python3.8.0). if 3.8.0 gets removed, that symlink is also removed unless any higher version is present in which case the symlink is replaced to point there.

(Oct-26-2019, 11:25 AM)snippsat Wrote: I do no like this approach of finding a Python version and install for User,the more normal way is to set a minimum required Python version.

then how do i notify the user about the version issue?

(Oct-26-2019, 11:25 AM)snippsat Wrote: My guess is that you don't use Python ecosystem like (pip, setup.py, Wheel, PyPi),but make you own stuff Wink
i do make my own stuff because in the past it was my common practice to do that because i needed stuff before generally available stuff became available. so i got into that habit and developed such skills. now with python, i don't need to since so much is already available. but it's still difficult because there is so much. i do search pip but usually find too much. i have tried stuff and often gotten junk or something entirely unexpected. it is rare to find gems, though it has happened.

now i have the opposite problem, too many things to choose from. i need to test so many things to find something i can use. i end up making my own stuff because i need something sooner than i can find something else.

i do use python ecosystem where i know about it.

one issue is that many of my scripts need to work where many common things, even things i actually use, are just not available, or not done right. for example, today, i don't even try to support python2. it has been over 10 years since python3 was released (2008-12-03). anyone not at least having it available, shame on them (will /usr/bin/python -> python3 next year?).

it would be nice to see an uncluttered document that indexes through the best of the ecosystem. it should not present every possible thing in each category unless it at least describes the best one or at least best few. i know that would be a lot of work by someone. but it would also have great value. for stuff with APIs, it should describe the general approach of the APIs, such as if it uses callbacks. a list of its abstractions can help.

after 2019-12-31, at least, things could be a lot easier. we can pretend python2 is not there.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: run my script in a spefic version or any later one - by Skaperen - Oct-26-2019, 11:10 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020