Finally I chose a different solution. This works on Windows.
This morning I installed Python 3.1.2 because I was suffering from having different versions at home and in my workplace. 3.1.2 is default. Now, I have a *p.bat* in my Pywikipedia directory with the content: @c:"program files"\python25\python %1 %2 %3 %4 %5 %6 %7 %8 %9 I think, so many parameters should be enough.
From this time instead of "replace.py" I have to type "p replace.py", and in
the several batch files I have for common Pywiki tasks, instead of "replace.py <parameteres>" I have to write "call p replace.py <parameteres>" etc. This seems to work correctly. Not too comfortable, but this is the least intervention that makes possible to use two distributions on the same Windows. For all my tasks other than Pywiki I will use Python 3, so elsewhere no modification is needed.
2010/9/19 Dr. Trigon dr.trigon@surfeu.ch
You can have 2 python installations in two different directories, e.g.
c:\something\python3.1 c:\something\python2.5
and you add e.g. a file into each of your bot dirs, that tag the dir according to the python version you like to use, e.g. create files names '.\runpy31' or '.\runpy25'
then do something like the following for 'something.py':
import os
exec = ' '.join(sys.argv[1:])
if os.path.exists('.\runpy25'): os.system('c:\something\python3.5 %s' % exec) elif os.path.exists('.\runpy31'): os.system('c:\something\python3.1 %s' % exec) else: print "Unable to detect wished python version!"
This should more or less do the job you wanted... ;)
Greetings DrTrigon
Am 19.09.2010 13:16, schrieb Bináris:
For some reason, I should install Python 3.1 on my Windows XP, and I want to keep 2.5 for pywikibot. Now, I am looking for some easy and comfortable way to separate them. I mean, if I type "something.py" at the command prompt in my Pywikipedia directory, then the script should run under 2.5, and if I type this in another directory, then it should run under 3.1. Is it possible?
-- Bináris
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l