question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pytest failed to run on windows: OSError: [WinError 87]

See original GitHub issue

I’m using a clean virtual env on windows 7 with python 3.7.4, the pytest is always failed with a OSError as below, on the same machine, i have succeeded to run the pytest on same code with a previou python version, is this related to an upgrade with python?

(calculator) D:\workspace\CalculatorLibrary>pytest -h
Traceback (most recent call last):
  File "d:\python37\Lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\python37\Lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\workspace\calculator\Scripts\pytest.exe\__main__.py", line 9, in <module>
  File "d:\workspace\calculator\lib\site-packages\_pytest\config\__init__.py", line 55, in main
    config = _prepareconfig(args, plugins)
  File "d:\workspace\calculator\lib\site-packages\_pytest\config\__init__.py", line 200, in _prepareconfig
    pluginmanager=pluginmanager, args=args
  File "d:\workspace\calculator\lib\site-packages\pluggy\hooks.py", line 289, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "d:\workspace\calculator\lib\site-packages\pluggy\manager.py", line 87, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "d:\workspace\calculator\lib\site-packages\pluggy\manager.py", line 81, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "d:\workspace\calculator\lib\site-packages\pluggy\callers.py", line 203, in _multicall
    gen.send(outcome)
  File "d:\workspace\calculator\lib\site-packages\_pytest\helpconfig.py", line 89, in pytest_cmdline_parse
    config = outcome.get_result()
  File "d:\workspace\calculator\lib\site-packages\pluggy\callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "d:\workspace\calculator\lib\site-packages\pluggy\callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "d:\workspace\calculator\lib\site-packages\_pytest\config\__init__.py", line 661, in pytest_cmdline_parse
    self.parse(args)
  File "d:\workspace\calculator\lib\site-packages\_pytest\config\__init__.py", line 869, in parse
    self._preparse(args, addopts=addopts)
  File "d:\workspace\calculator\lib\site-packages\_pytest\config\__init__.py", line 825, in _preparse
    early_config=self, args=args, parser=self._parser
  File "d:\workspace\calculator\lib\site-packages\pluggy\hooks.py", line 289, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "d:\workspace\calculator\lib\site-packages\pluggy\manager.py", line 87, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "d:\workspace\calculator\lib\site-packages\pluggy\manager.py", line 81, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "d:\workspace\calculator\lib\site-packages\pluggy\callers.py", line 208, in _multicall
    return outcome.get_result()
  File "d:\workspace\calculator\lib\site-packages\pluggy\callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "d:\workspace\calculator\lib\site-packages\pluggy\callers.py", line 182, in _multicall
    next(gen)  # first yield
  File "d:\workspace\calculator\lib\site-packages\_pytest\capture.py", line 42, in pytest_load_initial_conftests
    _py36_windowsconsoleio_workaround(sys.stdout)
  File "d:\workspace\calculator\lib\site-packages\_pytest\capture.py", line 815, in _py36_windowsconsoleio_workaround
    sys.stdin = _reopen_stdio(sys.stdin, "rb")
  File "d:\workspace\calculator\lib\site-packages\_pytest\capture.py", line 808, in _reopen_stdio
    open(os.dup(f.fileno()), mode, buffering),
OSError: [WinError 87] 参数错误。

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

6reactions
siben168commented, Aug 11, 2019

I have reinstalled to use python 3.7.3, and everything works just fine, it seems a compatibility issue between python 3.7.4 and pytest.

3reactions
nicoddemuscommented, Aug 26, 2019

Closing this for now given that this was fixed upstream. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

CreateProcess from python results in "OSError: [WinError 87 ...
I have a python program that runs another program as a subprocess. It works fine on linux/mac but on windows I get the...
Read more >
Getting error with pytest OSError: [WinError 87] The parameter ...
I have installed pytest but getting the following error ...
Read more >
All attempts to run pytest is failing with the same banch of errors
I was able to complete Chapter 1, but pytest is giving me a problem: ... mode, buffering), OSError: [WinError 87] The parameter is...
Read more >
Getting error with pytest OSError: [WinError 87] The ... - YouTube
Getting error with pytest OSError : [ WinError 87 ] The parameter is incorrectHelpful? Please support me on Patreon: ...
Read more >
Anaconda Package Installation OSError(22, 'The parameter is ...
link:_execute(502): An error occurred while installing package 'conda-forge::pyopengl-3.1.1a1-py_1'. OSError(22, 'The parameter is incorrect', None, 87, None) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found