Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Cannot locate a COMSPEC environment variable... with os.popen on Windows #359

pytoxbot opened this issue Sep 17, 2016 · 0 comments · Fixed by dropseed/sweep#11


Copy link

@pytoxbot pytoxbot commented Sep 17, 2016

The distutils uses os.popen, which seems to require the %COMSPEC% environment variable to be set, else it raises a runtime error (see traceback below).

If I use passenv = COMSPEC in my tox.ini, then it works fine.
The value of the variable on my system is the default C:\Windows\system32\cmd.exe.



py27 runtests: commands[2] | python test
running pytest
running egg_info
writing top-level names to src/python\compreffor.egg-info\top_level.txt
writing dependency_links to src/python\compreffor.egg-info\dependency_links.txt
writing src/python\compreffor.egg-info\PKG-INFO
reading manifest file 'src/python\compreffor.egg-info\SOURCES.txt'
reading manifest template ''
writing manifest file 'src/python\compreffor.egg-info\SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "", line 168, in <module>
  File "C:\Python27-mingwpy\Lib\distutils\", line 151, in setup
  File "C:\Python27-mingwpy\Lib\distutils\", line 953, in run_commands
  File "C:\Python27-mingwpy\Lib\distutils\", line 972, in run_command
  File "build\bdist.win32\egg\", line 85, in run
  File "C:\UsersLocal\cosimo.lupo\Documents\GitHub\compreffor\.tox\py27\lib\site-packages\setuptools\command\", line 111, in with_project_on_sys_path
    with self.project_on_sys_path():
  File "C:\Python27-mingwpy\Lib\", line 17, in __enter__
  File "C:\UsersLocal\cosimo.lupo\Documents\GitHub\compreffor\.tox\py27\lib\site-packages\setuptools\command\", line 139, in project_on_sys_path
  File "C:\Python27-mingwpy\Lib\distutils\", line 326, in run_command
  File "C:\Python27-mingwpy\Lib\distutils\", line 972, in run_command
  File "C:\UsersLocal\cosimo.lupo\Documents\GitHub\compreffor\.tox\py27\lib\site-packages\setuptools\command\", line 68, in run
  File "C:\Python27-mingwpy\Lib\distutils\command\", line 306, in run
  File "C:\Python27-mingwpy\Lib\distutils\", line 1004, in new_compiler
    return klass(None, dry_run, force)
  File "C:\Python27-mingwpy\Lib\distutils\", line 306, in __init__
    CygwinCCompiler.__init__ (self, verbose, dry_run, force)
  File "C:\Python27-mingwpy\Lib\distutils\", line 107, in __init__
  File "C:\Python27-mingwpy\Lib\distutils\", line 420, in get_versions
    out = os.popen(gcc_exe + ' -dumpversion','r')
RuntimeError: Cannot locate a COMSPEC environment variable to use as the shell
ERROR: InvocationError: 'C:\\UsersLocal\\cosimo.lupo\\Documents\\GitHub\\compreffor\\.tox\\py27\\Scripts\\python.EXE test'
@hpk42 hpk42 closed this in 8c2d12b Oct 27, 2016
hpk42 added a commit that referenced this issue Oct 27, 2016
fix #359 -- add COMSPEC to passenv
@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant