我想子类化两个python类:一个来自PyGObject,一个来自python3-dbus:
import gi
from gi.repository import GObject
import dbus.service
class Test(GObject.Object, dbus.service.Object):
pass
但是我收到以下错误:
$ python3 test.py
Traceback (most recent call last):
File ".../test.py", line 5, in <module>
class Test(GObject.Object, dbus.service.Object):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
我已经发现这是因为GObject.Object
和dbus.service.Object
具有不同的元类,我也需要对它们进行子类化:
class M_Test(gi.types.GObjectMeta, dbus.service.InterfaceType):
pass
class Test(GObject.Object, dbus.service.Object):
__metaclass__=M_Test
pass
但是它没有帮助,我继续收到相同的错误。对于gi.types.GObjectMeta
和dbus.service.InterfaceType
,也许GObject.Object
和dbus.service.Object
不是正确的元类。有人知道如何合并GObject.Object
和dbus.service.Object
的元类吗?
答案 0 :(得分:1)
Python3更改了指定元类的语法。 PEP-3115
现在是<?php
if(isset($_GET["token"]) && isset($_GET["r"]))
{
$token = $_GET["token"];
$r = $_GET["r"];
$kript = 'r='. $r .';token=' . $token;
}
?>
。