#285 closed defect (fixed)

python error when multiple pythons installed

Reported by: Brent Fraser Owned by: Jeff McKenna
Priority: major Milestone: 4.0.5 release
Component: MS4W - Python Version: 4.0.4
Keywords: Cc: TC Haddad
Blocked By: Blocking:


When using the "MS4W-Shell", typing "python" results in:

Fatal Python error: init_sys_streams: can't initialize sys standard streams
Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\io.py", line 54, in <module>
ImportError: cannot import name 'open_code' from 'io' (unknown location)

This is due to my PYTHONHOME env variable being set to one of the other Python locations.

It would be nice if MS4W's setenv.bat would include:

set PYTHONHOME=C:\ms4w\Python

Change History (2)

comment:1 by Jeff McKenna, 16 months ago

Cc: TC Haddad added
Component: MS4W - BaseMS4W - Python

Great enhancement, will add to 4.0.5 release

comment:2 by Jeff McKenna, 12 months ago

Resolution: fixed
Status: newclosed

I did much testing for this. What is now enabled for MS4W 4.0.5 release is that the default setenv.bat does include a commented line as:

REM set PYTHONHOME=\ms4w\Python

but the setup.exe installer will change that line to:

set PYTHONHOME=[the user's selected drive & folder]\ms4w\Python

I did not fully enable this setting for the .zip users, as I found that using '\ms4w\Python' without the drive letter caused conflicts and problems in testing. So (the super)-users of the .zip can modify the commented line when needed. It's more important to handle the installer users.

Thanks for the feedback!!!

Note: See TracTickets for help on using tickets.