TypeError:构造函数返回NULL

2024-04-26 12:38:42 发布

您现在位置:Python中文网/ 问答频道 /正文

from gi.repository import GLib , GObject
from multiprocessing import Pipe
parent,child = Pipe(duplex=False)

一些代码。。。。在

^{pr2}$

一些代码。。。在

GObject.io_add_watch(parent.fileno() , GObject.IO_IN , myfonction )

然后我得到这个错误:

Traceback (most recent call last):
File "C:\msys64\mingw64\lib\python3.5\threading.py", line 914, in `_bootstrap_inner`
self.run()
File "C:\msys64\mingw64\lib\python3.5\threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "mnG.py", line 1091, in
test = Thread(target=(lambda : GObject.io_add_watch(parant.fileno(),  GObject.IO_IN, self.up)),name="GObject")
File "C:\msys64\mingw64\lib\python3.5\site-packages\gi\overrides\GLib.py", line 749, in io_add_watch
channel, priority, condition, func, user_data = _io_add_watch_get_args(*args, **kwargs)
File "C:\msys64\mingw64\lib\python3.5\site-packages\gi\overrides\GLib.py",  line 729, in _io_add_watch_get_args
real_channel = GLib.IOChannel.unix_new(channel)
TypeError: constructor returned NULL

但是这个小代码在Linux(debian)上可以正常工作。 为什么?如何从父级获得有效的文件描述符?


Tags: inpyioselfaddliblineargs