import sys
sys.version_info
if not sys.version_info[:2] == (3, 1):
raise Exception("You need Python >= 3.1")
else:
from your_module import whatever
I really hope no one's seriously using this repo to get any ideas. import sys
sys.version_info
if not sys.version_info[:2] == (3, 1):
raise Exception("You need Python >= 3.1")
else:
from your_module import whatever
I really hope no one's seriously using this repo to get any ideas. if sys.version_info < (3, 1):
... In [2]: sys.version_info
Out[2]: sys.version_info(major=3, minor=10, micro=1, releaselevel='final', serial=0)
In [3]: sys.version_info < (3, 10)
Out[3]: FalseWhat would be your suggestion to do this for single file scripts?
The point is obviously to let if fail, but clearly explain why it fails. This is obviously not meant for software distributed to users that are proficient in Python.
I guess it's useful for the kind of scripts you write and post in pastebin, or share on a web forum or whatever. Think a wrapper script that downloads and patches Wine so that it can run a certain exe or whatever. These users have never heard of pip, and you don't want to publish this stuff to pypi anyway. You just want to post it in a code block on forums.obscureindiegame.com so the three Linux users there can join the effin' game already!
Or so I would guess. Never felt a need for something similar myself.