2017-02-22 85 views
0

我们在我们的项目中使用了PyFilesystem。它工作正常的Windows 7 64位,但在Windows 7 X32这引发了一个异常:当发生异常PyFilesystem中的“LP_OVERLAPPED实例,而不是指向OVERLAPPED的指针”异常

Exception in thread Thread-28: 
Traceback (most recent call last): 
    File "C:\Python34\lib\threading.py", line 911, in _bootstrap_inner 
    self.run() 
    File "C:\environment\lib\site-packages\fs\osfs\watch_win32.py", line 365, in run 
    -1) 
ctypes.ArgumentError: argument 4: <class 'TypeError'>: expected LP_OVERLAPPED instance instead of pointer to OVERLAPPED 

代码:

... 
overlapped = OVERLAPPED() 
while not self.closed: 
    try: 
     GetQueuedCompletionStatus(self._iocp, 
            ctypes.byref(nbytes), 
            ctypes.byref(iocpkey), 
            ctypes.byref(overlapped), 
            -1) 
    except WindowsError: 
     traceback.print_exc() 
    ... 

我会感谢任何帮助。

回答

0

我有同样的问题,这是由于在这种情况下有一个其他模块watchdog定义相同功能的参数引起的。我建议打印GetQueuedCompletionStatus.argtypes。这会给你提示哪个模块PyFilesystem有冲突。

我的产量在这种情况下:

(<class 'ctypes.c_void_p'>, <class 'ctypes.c_void_p'>, <class 'ctypes.c_void_p'>, <class 'watchdog.observers.winapi.LP_OVERLAPPED'>, <class 'ctypes.c_ulong'>)

当第四ARG指向watchdog.observers.winapi.LP_OVERLAPPED,从而导致你到你的问题。