The python not starting under cmd.exe

John Machin sjmachin at lexicon.net
Wed Aug 13 06:53:49 EDT 2008


On Aug 13, 6:34 pm, "durumd... at gmail.com" <durumd... at gmail.com> wrote:
> Hi!
>
> My problem is that:
> The "test.py" is working in every machine that I use except in my home
> machine.
> Formerly it worked but now not. I don't know what happened, I searching
> for some solution.
>
> The errormessage is this (after I tried to start test.py under cmd.exe):
>
>     Microsoft Windows XP [verziószám: 5.1.2600]
>     (C) Copyright 1985-2001 Microsoft Corp.
>
>     c:\>test.py
>     A rendszer nem tudja végrehajtani a megadott programot.
>
>     c:\>
>
> Sorry for non english, I try to translate it:
> "The system cannot execute the program/application."
>
> Interesting thing that the starting from Explorer, FreeCommander, or
> other tool (Double clicking, Hit enter on it) is working good, so the
> "py" linked to the python.
> I tried to set path, and pathext too but it have no effect.
>
> This command is working:
> "python test.py".
>
> I don't know, why not working the "test.py" command, because in other
> machines it is working good... :-(((((

This may help:
====
C:\junk>help assoc
Displays or modifies file extension associations

ASSOC [.ext[=[fileType]]]

  .ext      Specifies the file extension to associate the file type
with
  fileType  Specifies the file type to associate with the file
extension

Type ASSOC without parameters to display the current file
associations.
If ASSOC is invoked with just a file extension, it displays the
current
file association for that file extension.  Specify nothing for the
file
type and the command will delete the association for the file
extension.

C:\junk>assoc .py
.py=Python.File

C:\junk>help ftype
Displays or modifies file types used in file extension associations

FTYPE [fileType[=[openCommandString]]]

  fileType  Specifies the file type to examine or change
  openCommandString Specifies the open command to use when launching
files
                    of this type.

Type FTYPE without parameters to display the current file types that
have open command strings defined.  FTYPE is invoked with just a file
type, it displays the current open command string for that file type.
Specify nothing for the open command string and the FTYPE command will
delete the open command string for the file type.  Within an open
command string %0 or %1 are substituted with the file name being
launched through the assocation.  %* gets all the parameters and %2
gets the 1st parameter, %3 the second, etc.  %~n gets all the
remaining
parameters starting with the nth parameter, where n may be between 2
and 9,
inclusive.  For example:

    ASSOC .pl=PerlScript
    FTYPE PerlScript=perl.exe %1 %*

would allow you to invoke a Perl script as follows:

    script.pl 1 2 3

If you want to eliminate the need to type the extensions, then do the
following:

    set PATHEXT=.pl;%PATHEXT%

and the script could be invoked as follows:

    script 1 2 3

C:\junk>ftype python.file
python.file="C:\Python25\python.exe" "%1" %*

====
HTH,
John



More information about the Python-list mailing list