The python not starting under cmd.exe

D

durumdara

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... :-(((((

Thanks for any advance in this problem!

dd
 
U

Ulrich Eckhardt

The "test.py" is working in every machine that I use except in my home
machine. [...]
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.

Maybe, maybe not. This 'linked to' is a notion of the shell (i.e. the
Explorer) so it doesn't apply to the CLI necessarily. Anyhow: I guess you
also can't run the interactive Python interpreter from the commandline
(just type 'python' to test that). If that is the case, you simply need to
add the path to the interpreter to the PATH environment variable:

set PATH=C:\Python42;%PATH%

You can also set this somewhere in your user profile, otherwise it only
affects the current commandline and processes started from it.
I tried to set path, and pathext too but it have no effect.

This command is working:
"python test.py".

Hmm, strange. From where did you issue that command? If it was from the
Python install dir, it will find the local python.exe even without the path
and might not do the same when it tries to find the handler from a call to
test.py. And what did you try to set the PATH and PATHEXT to?

Good luck and please drop a note if you manage to solve the issue!

Uli
 
J

John Machin

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
 
N

nntpman68

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:\>

Did you try

start test.py

from the command line?

Normally this tries to behave as if you clicked on the file from the
explorer?


bye



N
 
D

durumdara

Hi!

nntpman68 írta:
Did you try

start test.py

from the command line?

Normally this tries to behave as if you clicked on the file from the
explorer?


bye

The associations, filetypes are good:

H:\Dev\ImgOrder>ASSOC .py
..py=Python.File

H:\Dev\ImgOrder>ftype python.file
python.file="C:\Python25\python.exe" "%1" %*

But the start not working. And not only Python Program, but all start
failed...

In other machines the start "anything.xls", or "anything.html" or
"anything.jpg" is working good, it is starts the program that associated
with this file, and open the file.

But in this machine is not working. So it is not pythonic, it is windows
problem.

Thanks for your help! For everyone who helped me!

dd
 
F

Fredrik Lundh

H:\Dev\ImgOrder>ftype python.file
python.file="C:\Python25\python.exe" "%1" %*

But the start not working. And not only Python Program, but all start
failed...

In other machines the start "anything.xls", or "anything.html" or
"anything.jpg" is working good, it is starts the program that associated
with this file, and open the file.

But in this machine is not working. So it is not pythonic, it is windows
problem.

you might want to check if your antivirus/security software is somehow
involved with this (that's more likely on corporate machines, though,
where admins love to set corporate-wide "policies" that mess things up
for programmers ;-).

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top