in some new script code i want to abort, raising an exception, if found to be running under Python2 and unable to re-run the script under Python3. what exception type should i use for the case of being under Python2 with no way to switch to Python3? i don't really want to use OSError.
if bytes == str: import os,sys for p in os.environ.get('PATH','').split(':'): if p and os.path.exists(p+'/python3'): try: os.execvp(p+'/python3',['python3']+sys.argv) except: pass raise VersionError('Python2 is no longer supported - Please install Python3')
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.