Issues

Issue #164 resolved

If install_command raises an OSError, get a traceback that doesn't tell you what failed

Marc Abramowitz
created an issue
$ cat install_command_error.ini
[testenv]
install_command = ./LICENSE {packages}
deps = pytest
commands = py.test
$ tox -c install_command_error.ini
GLOB sdist-make: /Users/marca/dev/hg-repos/tox/setup.py
python create: /Users/marca/dev/hg-repos/tox/.tox/python
python installdeps: pytest
Traceback (most recent call last):
  File "/Users/marca/python/virtualenvs/tox/bin/tox", line 9, in <module>
    load_entry_point('tox==1.7.1', 'console_scripts', 'tox')()
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 26, in main
    retcode = Session(config).runcommand()
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 303, in runcommand
    return self.subcommand_test()
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 440, in subcommand_test
    if self.setupenv(venv):
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 360, in setupenv
    status = venv.update(action=action)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 142, in update
    self.install_deps(action)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 255, in install_deps
    self._install(deps, action=action)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 318, in _install
    action=action, extraenv=extraenv)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 285, in run_install_command
    extraenv=env, action=action)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 367, in _pcall
    return action.popen(args, cwd=cwd, env=env, redirect=redirect)
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 97, in popen
    stdout=f, stderr=STDOUT)
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 155, in _popen
    stdout=stdout, stderr=stderr, env=env)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 709, in __init__
    errread, errwrite)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1326, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied

Note that the traceback doesn't tell you what the problem is -- that the install_command ("./LICENSE") was not executable.

Comments (3)

  1. Marc Abramowitz reporter

    PR that attempt to fix this: https://bitbucket.org/hpk42/tox/pull-request/92/log-more-info-when-catch-oserror-while/diff

    With this, I get:

     ❯ tox -c install_command_error.ini
    GLOB sdist-make: /Users/marca/dev/hg-repos/tox/setup.py
    python create: /Users/marca/dev/hg-repos/tox/.tox/python
    python installdeps: pytest
    ERROR: invocation failed, args: ['/Users/marca/dev/hg-repos/tox/LICENSE', 'pytest'], cwd: /Users/marca/dev/hg-repos/tox
    Traceback (most recent call last):
      File "/Users/marca/python/virtualenvs/tox/bin/tox", line 9, in <module>
        load_entry_point('tox==1.7.1', 'console_scripts', 'tox')()
      File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 26, in main
        retcode = Session(config).runcommand()
      File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 308, in runcommand
        return self.subcommand_test()
      File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 445, in subcommand_test
        if self.setupenv(venv):
      File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 365, in setupenv
        status = venv.update(action=action)
      File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 142, in update
        self.install_deps(action)
      File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 255, in install_deps
        self._install(deps, action=action)
      File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 318, in _install
        action=action, extraenv=extraenv)
      File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 285, in run_install_command
        extraenv=env, action=action)
      File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 367, in _pcall
        return action.popen(args, cwd=cwd, env=env, redirect=redirect)
      File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 98, in popen
        stdout=f, stderr=STDOUT)
      File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 160, in _popen
        stdout=stdout, stderr=stderr, env=env)
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 709, in __init__
        errread, errwrite)
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1326, in _execute_child
        raise child_exception
    OSError: [Errno 13] Permission denied
    
  2. Log in to comment