so how do I run this thing?!!!!

David C. Ullrich ullrich at math.okstate.edu
Mon Feb 28 12:13:02 EST 2000


    Assuming he's trying to run Python code "from Windows", as
opposed to from inside some Python shell program:

    It's not hard to make Windows understand what he wants to do.
Like you can make a file py.reg that looks like this:

REGEDIT4

[HKEY_CLASSES_ROOT\.py]
@="DUPythonFile"

[HKEY_CLASSES_ROOT\DUPythonFile]
@="DUPythonFile"

[HKEY_CLASSES_ROOT\DUPythonFile\DefaultIcon]
@="D:\\Python\\Py.ico"

[HKEY_CLASSES_ROOT\DUPythonFile\shell]
@="Edit"

[HKEY_CLASSES_ROOT\DUPythonFile\shell\Edit]

[HKEY_CLASSES_ROOT\DUPythonFile\shell\Edit\command]
@="C:\\windows\\notepad.exe %1"

[HKEY_CLASSES_ROOT\DUPythonFile\shell\Run(DOS)]

[HKEY_CLASSES_ROOT\DUPythonFile\shell\Run(DOS)\command]
@="d:\\python\\py.bat %1"

[HKEY_CLASSES_ROOT\DUPythonFile\shell\Initialize Interpreter]

[HKEY_CLASSES_ROOT\DUPythonFile\shell\Initialize Interpreter\command]
@="d:\\python\\python.exe -i %1"

[HKEY_CLASSES_ROOT\DUPythonFile\shell\PyWin(Edit)]

[HKEY_CLASSES_ROOT\DUPythonFile\shell\PyWin(Edit)\command]
@="d:\\Python\\Pythonwin\\pythonwin.exe /edit %1"

[HKEY_CLASSES_ROOT\DUPythonFile\shell\PyWin(Run)]

[HKEY_CLASSES_ROOT\DUPythonFile\shell\PyWin(Run)\command]
@="d:\\Python\\Pythonwin\\pythonwin.exe /run %1"

    The REGEDIT4 should be the first line of the file. If you execute
that file then *.py files will have associations just like on my machine
here - if you edit the path names, etc then you get what you want.

    And you save the py.reg file, so when installing something changes
the associations you re-merge the py.reg file and they're back
the way you want. Very handy for fixing things when some new
program thinks you want it to take over every file extension
it can think of.

    Using Unix would probably also work, but that's an awfully
drastic step.

Ray Loyzaga wrote:

> Collin Greene wrote:
> >
> > thanks for all you help everyone, I know how to basicially use Python now
> > but I don't really understand it seems as if there should be a way to run
> > what you have written. I have tried the run command but it just showns me
> > what i just wrote. Is there a place to actuially see waht you have witten?
> > thanks greene at hctc.com
>
> Use Unix.
>
> Your windows machine thinks that it should open the file in one of the
> "text" displaying applications.




More information about the Python-list mailing list