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

uwe*_*vil 5 python windows-10

自从我将win 10版本1703升级到版本1709(Fall Update)后,我在使用或命令时遇到了持久性问题OSError.我的日志:printnosenose

======================================================================
ERROR: test_future_link_to_update_3
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\users\sdn\work\git\pop-extrapole\env\lib\site-packages\nose\case.py", line 134, in run
    self.runTest(result)
  File "c:\users\sdn\work\git\pop-extrapole\env\lib\site-packages\nose\case.py", line 152, in runTest
    test(result)
  File "c:\program files\python35\Lib\unittest\case.py", line 653, in __call__
    return self.run(*args, **kwds)
  File "c:\program files\python35\Lib\unittest\case.py", line 621, in run
    result.addSuccess(self)
  File "c:\users\sdn\work\git\pop-extrapole\env\lib\site-packages\nose\proxy.py", line 165, in addSuccess
    self.result.addSuccess(self.test)
  File "c:\program files\python35\Lib\unittest\runner.py", line 64, in addSuccess
    self.stream.flush()
OSError: raw write() returned invalid length 2 (should have been between 0 and 1)
Run Code Online (Sandbox Code Playgroud)

我可以通过评论来传递这个问题,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()
Run Code Online (Sandbox Code Playgroud)

使用时的其他日志print:

Traceback (most recent call last):
  File "c:\program files\python35\Lib\multiprocessing\pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "c:\program files\python35\Lib\multiprocessing\pool.py", line 47, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "C:\Users\SDN\Work\git\pop-extrapole\extrapolation\extrapole.py", line 1463, in popcorn_process
    print(lk)
OSError: raw write() returned invalid length 46 (should have been between 0 and 23)
Run Code Online (Sandbox Code Playgroud)

有没有人对此有所了解?

谢谢,Uwevil

小智 0

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

如果使用,请尝试在 \Program Files\Git\git-bash.exe和的属性设置中添加管理员权限\Program Files\Git\usr\bin\bash.exe

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

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