我试图从扩展示例本教程通过发送Python对象到Java。 虽然其交换Python和Java之间的String对象的示例代码工作正常,当我试图用我自己的Python对象(事件)来代替它,则会显示有关的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 <module>
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'
任何想法,这可怎么解决呢?