* luis:
Hi

I am not an expert in programming and using Python for its simplicity

I have 2 versions of python installed on my computer (windos xp) to
begin the transition from version 2.4 to 2.6 or 3. maintaining the
operability of my old scripts

Is there any way to indicate the version of the python interpreter
must use a script?

I think the most direct way is to use different filename extensions, and associate them with corresponding interpreters via the 'assoc' and 'ftype' Windows commands.

An alternative is to associate '.py' and '.pyw' with two dummy programs (console and GUI subsystem programs) that in some way determines the Python version of the script and invokes the right interpreter.

Offhand I can think of three ways to let such a dummy program know the Python version of a script (filename extensions are not a way because with distinct filename extensions you don't need the dummy program):

  * version information in comment in the file.

  * version information in the filename, like e.g. 'myscript.python31.py',
    or version information in the general path, e.g. 'python31\myscript.py'.

  * version information in some kind of 'database', which might be a
    separate file or simply hardcoded in your dummy startup program.

But I think personally I'd go for filename extensions and using 'assoc' and 'ftype', because while ugly it's simplest, like '.py24', '.py26', 'py31'.


Cheers & hth.,

- Alf
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to