From: Mark Carter on
On my machine, I can go to a DOS shell, and type
myscript.py
This will cause the script to be run as a python script. So that bit
works.

On another machine, on which python was set up without admin
privileges, if I type
myscript.py
it will open the "Open With" dialog box. It wont let me execute it
with python.exe. It asks me the same question every time, too. If I
type
python myscript.py
then everything works fine.

Is there a way of setting up the "other" machine so that it replicates
the behaviour of my machine?
From: Thomas Jollans on
On 07/09/2010 11:37 AM, Mark Carter wrote:
> On my machine, I can go to a DOS shell, and type
> myscript.py
> This will cause the script to be run as a python script. So that bit
> works.
>
> On another machine, on which python was set up without admin
> privileges, if I type

Which operating systems are we talking about?

> myscript.py
> it will open the "Open With" dialog box. It wont let me execute it
> with python.exe.

What does that mean, exactly? What happens when you try to select python?

> It asks me the same question every time, too. If I
> type
> python myscript.py
> then everything works fine.
>
> Is there a way of setting up the "other" machine so that it replicates
> the behaviour of my machine?

Depends on which OS we're talking about. I'm guessing you're using
Windows, but I don't know which version, and I don't possess the
Registry-fu you'll probably need.
From: Rebelo on
On 9 srp, 11:37, Mark Carter <alt.mcar...(a)gmail.com> wrote:
> On my machine, I can go to a DOS shell, and type
>    myscript.py
> This will cause the script to be run as a python script. So that bit
> works.
>
> On another machine, on which python was set up without admin
> privileges, if I type
>    myscript.py
> it will open the "Open With" dialog box. It wont let me execute it
> with python.exe. It asks me the same question every time, too. If I
> type
>    python myscript.py
> then everything works fine.
>
> Is there a way of setting up the "other" machine so that it replicates
> the behaviour of my machine?

http://docs.python.org/release/2.6.5/using/windows.html for python
2.6.5 on windows
especially chapter 3.3.4. Executing scripts

for python 2.7 :
http://docs.python.org/using/windows.html
same chapter

for python 3.0 :
http://docs.python.org/py3k/using/windows.html#executing-scripts


From: Dave Angel on
Mark Carter wrote:
> On my machine, I can go to a DOS shell, and type
> myscript.py
> This will cause the script to be run as a python script. So that bit
> works.
>
> On another machine, on which python was set up without admin
> privileges, if I type
> myscript.py
> it will open the "Open With" dialog box. It wont let me execute it
> with python.exe. It asks me the same question every time, too. If I
> type
> python myscript.py
> then everything works fine.
>
> Is there a way of setting up the "other" machine so that it replicates
> the behaviour of my machine?
>
>
Assuming you're talking Windows XP, Vista or Win7 you can do the following:

There are registry settings in two places, hklm and hkcu. If you only
have one user on the machine, it probably doesn't matter. in that case,
there's a nice commandline way to make these associations.

assoc creates associations beteween a file extension and a string
ftype creates an association between that string and an executable
program.

On my machine, assoc .py shows

..py=Python.File

and ftype Python.File shows

python.file="C:\PrgFiles\APYTHO~1\python.exe" "%1" %*



Or you can read the following link:

http://msdn.microsoft.com/en-us/library/ms724475(VS.85).aspx


DaveA