Startup problems with Python 3.1.2 and PythonPath under XP

T

tkpmep

I run Python under Windows XP SP3, and for the longest time, I have
installed it on my C: drive under C:\PythonXX (XX = 20, 21., ....26),
and maintained all my Python files on our network in a directory
called H:\Python that I point to by creating an environment variable
called PYTHONPATH. I recently installed 3.1.2 under C:\Python31, and
now IDLE crashes every single time Python 3.1 starts up. If I remove
PYTHONPATH, it starts up without a problem. The mystery deepens -
Python 2.6 starts without a hiccup with or without PYTHONPATH! What
could the issue be? Is there any other way to have H:\Python appended
to sys.path when I start Python 3.1?

Thank you in advance for your help and advice

Thomas Philips
 
T

tkpmep

I fixed the problem by creating a file call MyPath.pth that has only
one line
H:/Python

and placing it in the C:\Python31\Lib\site-packages directory. So as a
practical matter, my problem is solved. That said, I'm still puzzled
by why Python 3.1 acts up when I set the environment variable
PYTHONPATH. It certainly caused no problem with the 2.X series.
 
M

Martin v. Loewis

I fixed the problem by creating a file call MyPath.pth that has only
one line
H:/Python

and placing it in the C:\Python31\Lib\site-packages directory. So as a
practical matter, my problem is solved. That said, I'm still puzzled
by why Python 3.1 acts up when I set the environment variable
PYTHONPATH. It certainly caused no problem with the 2.X series.

Most likely, H:\Python contains a module with a name that conflicts with
the standard library. Starting IDLE tries to import that module - but
not from the standard library, but your own version. That module then
(of course) fails to work correctly. By putting in a pth file, h:\python
is *appended* to sys.path, not prepended.

However, the real fix is not to use module names that conflict with the
standard library.

Run idle.py in a cmd.exe shell window to find out what the true cause of
the problem is.

HTH,
Martin
 

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,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top