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

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

Comments

@pytoxbot
Copy link

@pytoxbot pytoxbot commented Sep 17, 2016

The distutils cygwinccompiler.py 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.

Thanks,

Cosimo

py27 runtests: commands[2] | python setup.py 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 'MANIFEST.in'
writing manifest file 'src/python\compreffor.egg-info\SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 168, in <module>
    setup(**setup_params)
  File "C:\Python27-mingwpy\Lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "C:\Python27-mingwpy\Lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Python27-mingwpy\Lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "build\bdist.win32\egg\ptr.py", line 85, in run
  File "C:\UsersLocal\cosimo.lupo\Documents\GitHub\compreffor\.tox\py27\lib\site-packages\setuptools\command\test.py", line 111, in with_project_on_sys_path
    with self.project_on_sys_path():
  File "C:\Python27-mingwpy\Lib\contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "C:\UsersLocal\cosimo.lupo\Documents\GitHub\compreffor\.tox\py27\lib\site-packages\setuptools\command\test.py", line 139, in project_on_sys_path
    self.run_command('build_ext')
  File "C:\Python27-mingwpy\Lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "C:\Python27-mingwpy\Lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\UsersLocal\cosimo.lupo\Documents\GitHub\compreffor\.tox\py27\lib\site-packages\setuptools\command\build_ext.py", line 68, in run
    _build_ext.run(self)
  File "C:\Python27-mingwpy\Lib\distutils\command\build_ext.py", line 306, in run
    force=self.force)
  File "C:\Python27-mingwpy\Lib\distutils\ccompiler.py", line 1004, in new_compiler
    return klass(None, dry_run, force)
  File "C:\Python27-mingwpy\Lib\distutils\cygwinccompiler.py", line 306, in __init__
    CygwinCCompiler.__init__ (self, verbose, dry_run, force)
  File "C:\Python27-mingwpy\Lib\distutils\cygwinccompiler.py", line 107, in __init__
    get_versions()
  File "C:\Python27-mingwpy\Lib\distutils\cygwinccompiler.py", 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 setup.py 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.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant