当使用nosetest或print时,oserror python 3.5.4 on win 10 1709

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了当使用nosetest或print时,oserror python 3.5.4 on win 10 1709相关的知识,希望对你有一定的参考价值。

由于我将win 10版本1703升级到版本1709(Fall Update),因此在使用printnose命令时出现持续性问题OSError。我与nose的日志:

======================================================================
ERROR: test_future_link_to_update_3
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:userssdnworkgitpop-extrapoleenvlibsite-packages
osecase.py", line 134, in run
    self.runTest(result)
  File "c:userssdnworkgitpop-extrapoleenvlibsite-packages
osecase.py", line 152, in runTest
    test(result)
  File "c:program filespython35Libunittestcase.py", line 653, in __call__
    return self.run(*args, **kwds)
  File "c:program filespython35Libunittestcase.py", line 621, in run
    result.addSuccess(self)
  File "c:userssdnworkgitpop-extrapoleenvlibsite-packages
oseproxy.py", line 165, in addSuccess
    self.result.addSuccess(self.test)
  File "c:program filespython35Libunittest
unner.py", line 64, in addSuccess
    self.stream.flush()
OSError: raw write() returned invalid length 2 (should have been between 0 and 1)

我可以通过评论self.stream.flush()来传递这个问题,但它不是一个解决方案:

def addSuccess(self, test):
    super(TextTestResult, self).addSuccess(test)
    if self.showAll:
       self.stream.writeln("ok")
    elif self.dots:
       self.stream.write('.')
       # self.stream.flush()

使用print时的其他日志:

Traceback (most recent call last):
  File "c:program filespython35Libmultiprocessingpool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "c:program filespython35Libmultiprocessingpool.py", line 47, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "C:UsersSDNWorkgitpop-extrapoleextrapolationextrapole.py", line 1463, in popcorn_process
    print(lk)
OSError: raw write() returned invalid length 46 (should have been between 0 and 23)

有没有人对此有所了解?

谢谢,Uwevil

答案

你使用“Git for Windows”的bash吗?

如果您使用,请尝试将管理员权限添加到Program FilesGitgit-bash.exeand Program FilesGitusrinash.exe的属性设置中。

我可以解决它。但我认为这不是最佳解决方案。

另一个解决方案是使用PowerShell。

另一答案

我认为这个问题似乎是根据这个帖子将python 3.5.4升级到python 3.6.4来处理的:https://bugs.python.org/issue32245

以上是关于当使用nosetest或print时,oserror python 3.5.4 on win 10 1709的主要内容,如果未能解决你的问题,请参考以下文章

使用nosetests进行测试时,可以将warn.filterwarnings设置为本地操作

ModuleNotFoundError:没有名为“numpy.testing.nosetester”的模块

你如何从pycharm运行nosetest?

强制 Nosetests 使用 Python 2.7 而不是 3.4

ModuleNotFoundError: No module named 'numpy.testing.nosetester'----import sklearn.datasets.m

ModuleNotFoundError: No module named 'numpy.testing.nosetester'