XP with C:\python in path won't run files in C:\python

365 views Asked by At

XP Command Line:

helloworld.py is located in C:\python
C:\python is in the path
xxxxxx is the user environment path

This works:

xxxxx> cd C:\python
C:\python>helloworld.py
Hello World

This doesn't work:

xxxxx> helloworld.py

.....can't find the file ... but the folder with the file is in the PATH????

3

There are 3 answers

0
dgrif On

try logging out and back in. technically you should only have to launch a new cmd.exe for it to work iirc, but if you can logout and back in your new environment variable should definitely be in affect.

2
Martin Beckett On

Is python.exe in the directory c:\python?

type 'path' to check what the path is actually set to.

0
AudioBubble On

There's a difference between files with a specific a file extension (e.g. .py) being registered to be opened with a specific executable (e.g. python.exe - Windows doesn't see any difference between this and a .pdf file opened by a PDF viewer, it's just opening it and doing something) and that file extension being registered as file extensions for executable files such that files with this extension be launches as an external command from a directory in PATH (you can even omit the file extension in this case). The latter is specified in an enviromental variable called PATHEXT - adding .PY to the list should allow invoking the script directly from other locations.