From: Christian Heimes on
Am 25.07.2010 21:32, schrieb Thomas Jollans:
> If a script uses sys.executable instead of "python", there is no
> problem, at all.

It's true that sys.executable is the best way if you have to start a new
Python interpreter. However sys.executable may not be set for NT
services. So there may be a problem after all.

From: Thomas Jollans on
On 07/25/2010 09:39 PM, Christian Heimes wrote:
> Am 25.07.2010 21:32, schrieb Thomas Jollans:
>> If a script uses sys.executable instead of "python", there is no
>> problem, at all.
>
> It's true that sys.executable is the best way if you have to start a new
> Python interpreter. However sys.executable may not be set for NT
> services. So there may be a problem after all.

Interesting. Does the multiprocessing module still work in that scenario?
From: News123 on
sOn 07/25/2010 09:39 PM, Christian Heimes wrote:
> Am 25.07.2010 21:32, schrieb Thomas Jollans:
>> If a script uses sys.executable instead of "python", there is no
>> problem, at all.


sys.executable will not work with scripts converted with py2exe,
as sys.executable will not be the executable of the python interpreter,
but with the main executable's name.





>
> It's true that sys.executable is the best way if you have to start a new
> Python interpreter. However sys.executable may not be set for NT
> services. So there may be a problem after all.
>

From: Thomas Jollans on
On 07/25/2010 10:04 PM, News123 wrote:
> sOn 07/25/2010 09:39 PM, Christian Heimes wrote:
>> Am 25.07.2010 21:32, schrieb Thomas Jollans:
>>> If a script uses sys.executable instead of "python", there is no
>>> problem, at all.
>
>
> sys.executable will not work with scripts converted with py2exe,
> as sys.executable will not be the executable of the python interpreter,
> but with the main executable's name.

Well, but a script converted with py2exe can't really ever assume that
there is a Python interpreter, at all.
From: News123 on
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