check interpreter version before running script
rbt
rbt at athop1.ath.vt.edu
Wed Apr 6 09:21:58 EDT 2005
Peter Otten wrote:
> rbt wrote:
>
>
>>Is there a recommended or 'Best Practices' way of checking the version
>>of python before running scripts? I have scripts that use the os.walk()
>>feature (introduced in 2.3) and users running 2.2 who get errors.
>>Instead of telling them, 'Upgrade you Python Install, I'd like to use
>>sys.version or some other way of checking before running.
>
>
> I like
>
> import os
>
> try:
> os.walk
> except AttributeError:
> # implement fallback
>
> No need to remember in which version the desired feature came to be.
>
> Peter
Thanks for all the tips. I found this tip from Peter the best for my
situation.
More information about the Python-list
mailing list