Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 13th, 2008, 09:35 AM
durumdara@gmail.com
Guest
 
Posts: n/a
Default The python not starting under cmd.exe

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

  #2  
Old August 13th, 2008, 10:05 AM
Ulrich Eckhardt
Guest
 
Posts: n/a
Default Re: The python not starting under cmd.exe

durumdara@gmail.com wrote:
Quote:
The "test.py" is working in every machine that I use except in my home
machine.
[...]
Quote:
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.
Quote:
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

--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

  #3  
Old August 13th, 2008, 11:55 AM
John Machin
Guest
 
Posts: n/a
Default Re: The python not starting under cmd.exe

On Aug 13, 6:34 pm, "durumd...@gmail.com" <durumd...@gmail.comwrote:
Quote:
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
  #4  
Old August 15th, 2008, 08:55 AM
durumdara@gmail.com
Guest
 
Posts: n/a
Default Re: The python not starting under cmd.exe

Hi!

nntpman68 írta:
Quote:
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

  #5  
Old August 15th, 2008, 09:05 AM
Fredrik Lundh
Guest
 
Posts: n/a
Default Re: The python not starting under cmd.exe

durumdara@gmail.com wrote:
Quote:
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>

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles