[Py4j-users] Using copy.deepcopy() with Java Objects
Status: Beta
Brought to you by:
barthe
From: Nicolò P. <nic...@us...> - 2011-03-16 10:24:33
|
Hi, I was experimenting with your library P4JS and I was wandering how to create a copy of a Java object in Python environment. So I tried with the Python copy module, starting from your "stack" example: >>> stack = gateway.entry_point.getStack() >>> stack JavaObject id=o0 >>> import copy >>> a = copy.deepcopy(stack) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/copy.py", line 173, in deepcopy y = copier(memo) File "/Library/Python/2.6/site-packages/py4j/java_gateway.py", line 343, in __call__ args_command = ''.join([get_command_part(arg, self.pool) for arg in new_args]) File "/Library/Python/2.6/site-packages/py4j/protocol.py", line 208, in get_command_part command_part = REFERENCE_TYPE + parameter._get_object_id() AttributeError: 'dict' object has no attribute '_get_object_id' Is there a way to success in coping objects? Thank you. Bye Nicolò Perino ______ PhD Student @ USI - Faculty of Informatics http://www.people.usi.ch/perinon/ |