Path Problem on W2K?

H

hokiegal99

I installed Python-2.3 into c:\Program Files\Python23 on a new W2K SP4
computer. When I write a Python script and run it from the command
prompt, I get the following error:

C:\>python 'name-of-script.py'
'python' is not recognized as an internal or external command,
operable program or batch file.

Here's what my path contains:

C:\>path
PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;"C:\Program
Files\Norton
SystemWorks\Norton Ghost\";C:\Program Files\SSH Communications
Security\SSH Secu
re Shell

Any ideas? I've reinstalled and rebooted several times. Also tried
adding c:\Program Files\Python23 to my path... still get the error.
 
B

Bertrand Geston

Bernard Delmée said:
This should work, though! Still it's advisable to install to
a path without space(s), otherwise the "idle" IDE won't work.
Try with "C\Program Files\Python23" in your path (with the quotes). Could
help you (or not :-( )
If you change your path in the System box, I suspect (not sure) that you
need to open a new DOS box to have the new PATH.
Good luck.
 
B

Bengt Richter

I installed Python-2.3 into c:\Program Files\Python23 on a new W2K SP4
computer. When I write a Python script and run it from the command
prompt, I get the following error:

C:\>python 'name-of-script.py'
'python' is not recognized as an internal or external command,
operable program or batch file.

Here's what my path contains:

C:\>path
PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;"C:\Program
Files\Norton
SystemWorks\Norton Ghost\";C:\Program Files\SSH Communications
Security\SSH Secu
re Shell

Any ideas? I've reinstalled and rebooted several times. Also tried
adding c:\Program Files\Python23 to my path... still get the error.

I generally avoid installing in c:\Program<abominable_space>Files\anything.
The space just creates a nuisance when you want to use the path simply
in other contexts than they had in mind. Could be that's happening.

If you don't get a simple answer, I would uninstall and then reinstall as
c:\python23\... or c:\myInstalls\python23\ etc. I use a separate partition
and put it at D:\python23\...

Then add ;C:\python23 or whatever you decide (something without embedded spaces ;-)
onto the path.
( probably settings>control panel>system>environment>... or similar on your system).
If you are in a console window, you will have to restart that, at least, for the path
change to show up, if it works like mine.

HTH

Regards,
Bengt Richter
 
I

Irmen de Jong

Bertrand said:
Try with "C\Program Files\Python23" in your path (with the quotes). Could
help you (or not :-( )

That should have read "C:\Program Files\Python23".
If it doesn't work, try

C:\Progra~1\Python23

This squiggle-path is the 8.3 notation.
--Irmen
 
D

Dennis Reinhardt

I generally avoid installing in
c:\Program<abominable_space>Files\anything.

c:\progra~1\anything

is a non-space way of specifying the same path.
 
I

Irmen de Jong

Dennis said:
c:\Program<abominable_space>Files\anything.

Related, but off-topic at the same time,
I've seen many programs on Windows that barf on the
default TEMP directory on Windows 2000 and XP.
That is defined as somewhere in

c:\documents and settings\username\temporary files

or something. Anyway, it contains one or more spaces.
Many -broken- tools (mostly installers!) choke on this,
that's why I always set TEMP (and TMP) to "C:\temp"
as soon as I get my hands on a 'clean' Win2000/Xp box...
(yup, get rid of the per-user-tempdir).

Bah. ;-)

spaces-in-paths-are-evilly-y'rs, Irmen de Jong
 
G

Graham Fawcett

I installed Python-2.3 into c:\Program Files\Python23 on a new W2K SP4
computer. When I write a Python script and run it from the command
prompt, I get the following error:

C:\>python 'name-of-script.py'
'python' is not recognized as an internal or external command,
operable program or batch file.

Here's what my path contains:

C:\>path
PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;"C:\Program
Files\Norton
SystemWorks\Norton Ghost\";C:\Program Files\SSH Communications
Security\SSH Secu
re Shell

Any ideas? I've reinstalled and rebooted several times. Also tried
adding c:\Program Files\Python23 to my path... still get the error.


Just a thought, but the SUBST command still works in Win2K.

C:\>subst /?
Associates a path with a drive letter.

SUBST [drive1: [drive2:]path]

Substitute drive letter "P" for C:\Program Files\python23. Then, add
P:\ to your path.

Benefits? No nasty spaces, a much shorter path, and quick access to
the Python directory when you're at the command line (just type "P:").

(To be fair, assigning P: to c:\Program Files, and adding P:\python23
to your path, is probably an idea with more mileage in it.)

I haven't used this specifically myself (I install python in
c:\python##), but I have often SUBST'd the drive letter S: for
\python##\lib\site-packages when I'm studying the code of a
recently-installed package. Much easier to pop open an editor window,
or a Explorer window, to "S:\somepackage" than its longer counterpart.

It might be quite fun to go SUBST-happy and transform all those lonely
unassigned drive letters into contributing members of society. Perhaps
U: could map to c:\Documents and Settings, W: could map to %WINDIR%,
X: to the folder where you hide your illicitly-gained MP3's...

It would be best to do the SUBST before login or service startup. I
*think* you can still use an autoexec.bat file in Win2K, but there's a
formal "startup script" approach that is blessed by Microsoft. Search
MS support for "How to Run a Batch File Before Logging on to Your
Computer".

Hope it helps.

-- Graham
 
D

Duncan Booth

Generally, for something like "Secure Shell", I find it much
easier just to write a little batch file that knows the full
path. Put these batch files in a directory called c:\bin
or c:\utils or something and add *that* to your path. Then
you can avoid excessive PATH creepage...

Alternatively create doskey macros for commands like that then you just
need one file with a load of macro definitions.
 
D

Duncan Booth

Does that let you execute them from other batch files? I
have a few dozen utilities which run Python scripts by executing
"call python scriptname.py" somewhere, relying on a .bat file
in the PATH. Does the DOSKEY approach work similarly?

No, DOSKEY just affects what you type, you would have to write the commands
out in full in a batch file.

If you are running a lot of Python scripts from the command prompt or batch
files, consider adding .py to the PATHEXT environment variable, that will
let you run scripts directly, e.g. "scriptname" instead of "python
scriptname.py", and will search PATH for the scripts. (However be aware
that redirecting doesn't work on most versions of windows for scripts
invoked this way!)
 

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,776
Messages
2,569,603
Members
45,190
Latest member
ClayE7480

Latest Threads

Top