classification
Title: Python 2.7.13 for Windows broken (from prompt)
Type: crash Stage: resolved
Components: Windows Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Frak N, eryksun, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Priority: normal Keywords:

Created on 2017-02-10 13:28 by Frak N, last changed 2017-02-18 21:01 by steve.dower. This issue is now closed.

Messages (8)
msg287532 - (view) Author: Frak N (Frak N) Date: 2017-02-10 13:28
I used to have an older version of python 2.7 that has worked for years. I just upgraded to 2.7.13 for Windows, 32 bit and now, I can't get the interpreter to run from the command line. It just returns to the DOS prompt.

c:\Python27>python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
c:\Python27>python

PC:
OS: Windows 7 - 64 bit (I am intentionally using the 32bit of python)
Processor: AMD PhenomII 975 Processor. 3.6GHz
RAM: 16GB
msg287533 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2017-02-10 13:42
Although I don't remember seeing a crash out as quick as this, common 
causes for this kind of thing are to do with environment variables 
pointing to still-existing or part-existing installations. Can you try:

set PY

from a command prompt, please, to see if any Python-related env vars are 
present. (Typically PYTHONHOME is the culprit)
msg287540 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-02-10 14:36
Readline is also a common culprit when it's crashing out at the interactive prompt. Try either uninstalling or upgrading any packages that may include a readline module.
msg287577 - (view) Author: Frak N (Frak N) Date: 2017-02-11 00:17
c:\Python27>SET PY
Environment variable PY not defined


I don't know anything about readline or how to find what uses it.
msg287578 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-02-11 00:25
To get more information during the Python initialization, you can try to run:

python -X faulthandler -S -v

* -X faulthandler: dump a traceback if python crashed (is it the case? I don't understand from the bug report)
* -S disables the site module
* -v enables verbose mode
msg287589 - (view) Author: Eryk Sun (eryksun) * Date: 2017-02-11 03:14
It doesn't appear to be a crash, but seems like the REPL is quitting because there's no input (e.g. like stdin is redirected to NUL). Echo %errorlevel%; it's probably 0. 

readline (pyreadline) is probably the culprit. Try the following shell commands to temporarily disable it:

    ren C:\Python27\Lib\site-packages\readline.py readline.py.bak
    del C:\Python27\Lib\site-packages\readline.pyc

If it's not installed, then these commands will fail.
msg287684 - (view) Author: Frak N (Frak N) Date: 2017-02-13 12:23
Excellent analysis guys! Thank you!

The -X faulthandler option didn't work.
The -S -v, however, did. 
Finally, renaming and deleting the readline entries fixed it such that I can now launch the REPL. 
Question. What does " disables the site module" for the -S option mean?

Now, what do I do about the (py)readline issue? Do I need to reinstall something?

Logs below:


c:\Python27>python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

c:\Python27>python -X faulthandler -S -v
-X is reserved for implementation-specific arguments
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

c:\Python27>python -X
-X is reserved for implementation-specific arguments
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

c:\Python27>python -X -faulthandler -S -v
-X is reserved for implementation-specific arguments
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

c:\Python27>python  -S -v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
>>> ^Z

# clear __builtin__._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.exitfunc
# clear sys.exc_type
# clear sys.exc_value
# clear sys.exc_traceback
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# clear sys.flags
# clear sys.float_info
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup __main__
# cleanup[1] zipimport
# cleanup[1] signal
# cleanup[1] exceptions
# cleanup[1] _warnings
# cleanup sys
# cleanup __builtin__
# cleanup ints: 6 unfreed ints
# cleanup floats

c:\Python27>python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

c:\Python27>ren C:\Python27\Lib\site-packages\readline.py readline.py.bak

c:\Python27>del C:\Python27\Lib\site-packages\readline.pyc

c:\Python27>python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
msg288091 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-02-18 21:01
You should be able to update whatever package installed that module. Unfortunately, we can't guess what that would be, but it's probably worthwhile updating all the packages you have installed.
History
Date User Action Args
2017-02-18 21:01:33steve.dowersetstatus: open -> closed
resolution: not a bug
messages: + msg288091

stage: resolved
2017-02-13 12:23:28Frak Nsetmessages: + msg287684
2017-02-11 03:14:20eryksunsetnosy: + eryksun
messages: + msg287589
2017-02-11 00:25:16vstinnersetmessages: + msg287578
2017-02-11 00:17:56Frak Nsetmessages: + msg287577
2017-02-10 14:36:58steve.dowersetmessages: + msg287540
2017-02-10 13:47:56vstinnersetnosy: + vstinner
2017-02-10 13:42:23tim.goldensetmessages: + msg287533
2017-02-10 13:28:11Frak Ncreate