News123 wrote:
On 07/25/2010 09:33 PM, Edward Diener wrote:
On 7/25/2010 10:31 AM, News123 wrote:
On 07/25/2010 02:46 PM, Edward Diener wrote:
On 7/25/2010 6:07 AM, Gelonida wrote:
How does a 'pystarter' program know where the file's location is which
is being invoked ?
the file's location would be somewhere in sys.argv
probably in sys.argv[1].
converting it to an abs path would return a directory which the python
file belongs to.
As to the first file line this is completely
unrealistic. What are you going to do, alter the first file line of
every script in a Python distribution and every script in every library
installed in a Python distribution ? Sorry, but a less intrusive
solution is much better and much less of a headache to say the least.
Well I would at least do it for all of my self written scripts.
It could allow a soft transition from 2.6 to 2.7 to 3.0 without having
to upgrade all scripts at the same time.
My intended solution would be a simple program which understands where
each co-existing Python distribution is installed on a system and what
the "name" of that distribution is. Then you tell the program which
Python distribution should be the current one by its "name", the current
one meaning the distribution which you want to be invoked at any given
time. The program then changes the PATH so that any references to the
Python directory and its subdirectories point to the "name" Python
directory tree, and changes the file associations so that the "name"
Python executables handle the Python associations.
This does have the weakness that I can not use more than one Python
distribution while Python is executing scripts. But I can personally
live with that since I have never encountered a situation where I must
use more than one Python distribution at the same time.
I guess it's rather difficult to find a solution which suits all.
The above minor weakness, that you mention would be a killer for me.
Currently I'm looking for solutions, where I can start python scripts
requireing different python versions at the same time.
Currently I'm staring the scripts manually from two different cmd line
windows with a different path name and an explicit python call,
Thus my idea of having a pystarter with a config file
mentioning which directories (tools) should use which python executable
I think that's the wrong way round. A pystarter should ask the _tool_
which version of Python it needs.
--
http://mail.python.org/mailman/listinfo/python-list