[issue19056] Windows 7, script exec not working without explicit cal of python.exe

Thierry Seunevel report at bugs.python.org
Fri Sep 20 11:28:48 CEST 2013


New submission from Thierry Seunevel:

Executing a script from the command prompt works if Python.exe called explicitly, doesn't work if script name only.
Example :
python.exe script.py is ok
script.py gives the following :
Traceback (most recent call last):
  File "D:\soft\python\lib\site.py", line 548, in <module>
    main()
  File "D:\soft\python\lib\site.py", line 530, in main
    known_paths = addusersitepackages(known_paths)
  File "D:\soft\python\lib\site.py", line 266, in addusersitepackages
    user_site = getusersitepackages()
  File "D:\soft\python\lib\site.py", line 241, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "D:\soft\python\lib\site.py", line 231, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "D:\soft\python\lib\sysconfig.py", line 516, in get_config_var
    return get_config_vars().get(name)
  File "D:\soft\python\lib\sysconfig.py", line 449, in get_config_vars
    import re
  File "D:\soft\python\lib\re.py", line 105, in <module>
    import sre_compile
  File "D:\soft\python\lib\sre_compile.py", line 14, in <module>
    import sre_parse
  File "D:\soft\python\lib\sre_parse.py", line 17, in <module>
    from sre_constants import *
  File "D:\soft\python\lib\sre_constants.py", line 18, in <module>
    from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
Association of py extension to the python.exe is ok, Path contains the path for python directory (and also to \lib) and is the first dir in path.
Why is there a difference between the 2 invocations as they are calling the same exe?

----------
components: Windows
messages: 198136
nosy: tsunwell
priority: normal
severity: normal
status: open
title: Windows 7, script exec not working without explicit cal of python.exe
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19056>
_______________________________________


More information about the Python-bugs-list mailing list