我试图通过将
Python对象发送到Java来扩展
this tutorial的示例.虽然在Python和Java之间交换String对象的示例代码工作正常,但当我尝试用我自己的Python对象(Event)替换它时,会显示有关object_id的错误.
Python代码:
class Event(object):
#some content here
stack = gateway.entry_point.getStack()
event = Event()
stack.push(event)
错误:
Traceback (most recent call last):
File "/home/******/src/py4jSample.py", line 19, in
stack.push(event)
File "/usr/local/lib/python2.7/dist-packages/py4j-0.7-py2.7.egg/py4j/java_gateway.py", line 423, in __call__
[get_command_part(arg, self.pool) for arg in new_args])
File "/usr/local/lib/python2.7/dist-packages/py4j-0.7-py2.7.egg/py4j/protocol.py", line 241, in get_command_part
command_part = REFERENCE_TYPE + parameter._get_object_id()
AttributeError: 'Event' object has no attribute '_get_object_id'
知道如何解决这个问题吗?