简体   繁体   English

OSError: [Errno 9] pipenv 中的文件描述符错误

[英]OSError: [Errno 9] Bad file descriptor in pipenv

I compiled dune in a pipenv virtual environment using Python 3.5.2 on Ubuntu 16.04.我在 Ubuntu 16.04 上使用 Python 3.5.2 在 pipenv 虚拟环境中编译了dune It compiled successfully, but when I am running the following script, I get a Bad file descriptor error and do not know why.它编译成功,但是当我运行以下脚本时,出现错误的文件描述符错误,不知道为什么。

from dune.grid import structuredGrid
grid = structuredGrid([0,0],[1,1],[10,10])
grid.plot()

This is the traceback error:这是回溯错误:

(dune) pcsgs04:[dune] >pipenv run python scripts/testGrid.py 
Traceback (most recent call last):
  File "/home/user/.local/share/virtualenvs/dune-gkp4O1Gp/lib/python3.5/site-packages/portalocker/portalocker.py", line 137, in lock
    fcntl.flock(file_.fileno(), flags)
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/share/virtualenvs/dune-gkp4O1Gp/lib/python3.5/site-packages/portalocker/utils.py", line 131, in acquire
    fh = self._get_lock(fh)
  File "/home/user/.local/share/virtualenvs/dune-gkp4O1Gp/lib/python3.5/site-packages/portalocker/utils.py", line 180, in _get_lock
    portalocker.lock(fh, self.flags)
  File "/home/user/.local/share/virtualenvs/dune-gkp4O1Gp/lib/python3.5/site-packages/portalocker/portalocker.py", line 141, in lock
    raise exceptions.LockException(exc_value, fh=file_)
portalocker.exceptions.LockException: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "scripts/testGrid.py", line 2, in <module>
    grid = structuredGrid([0,0],[1,1],[10,10])
  File "/home/user/.local/share/virtualenvs/dune-gkp4O1Gp/lib/python3.5/site-packages/dune/grid/core.py", line 44, in structuredGrid
    return yaspGrid(domain, dimgrid=len(lower))
  File "/home/user/.local/share/virtualenvs/dune-gkp4O1Gp/lib/python3.5/site-packages/dune/grid/_grids.py", line 40, in yaspGrid
    gridModule = module(includes, typeName, ctor)
  File "/home/user/.local/share/virtualenvs/dune-gkp4O1Gp/lib/python3.5/site-packages/dune/grid/grid_generator.py", line 199, in module
    module = generator.load(includes, typeName, typeHash, *args, **kwargs)
  File "/home/user/.local/share/virtualenvs/dune-gkp4O1Gp/lib/python3.5/site-packages/dune/generator/generator.py", line 147, in load
    return self.post(moduleName, source)
  File "/home/user/.local/share/virtualenvs/dune-gkp4O1Gp/lib/python3.5/site-packages/dune/generator/generator.py", line 105, in post
    module = builder.load(moduleName, source, self.typeName[0])
  File "/home/user/.local/share/virtualenvs/dune-gkp4O1Gp/lib/python3.5/site-packages/dune/generator/builder.py", line 109, in load
    with Lock(os.path.join(self.dune_py_dir, 'lock-all.lock'), flags=LOCK_SH):
  File "/home/user/.local/share/virtualenvs/dune-gkp4O1Gp/lib/python3.5/site-packages/portalocker/utils.py", line 197, in __enter__
    return self.acquire()
  File "/home/user/.local/share/virtualenvs/dune-gkp4O1Gp/lib/python3.5/site-packages/portalocker/utils.py", line 157, in acquire
    raise exceptions.LockException(exception)
portalocker.exceptions.LockException: [Errno 9] Bad file descriptor

Can anybody explain me what this issue means, I don't understand exactly what files are locked and throw this exception.任何人都可以向我解释这个问题意味着什么,我不明白哪些文件被锁定并抛出这个异常。

我想我在虚拟环境中使用 pipenv 缺少一些操作系统权限,并使用 miniconda 结束,我没有这个问题并且脚本运行没有错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM