Hello everybody,


being new to this list I first want to send greetings to everyone around here.


I joined because I ran into a problem with Jython 2.5.2 that I can’t easily solve on my own.


We embedded Jython into our own application which means we do calls to Python code from within java.


Within the call we need to make a deep copy of some structures that have been handed over from the java side so we have to deal with java style variables here.

Doing this I ran into the problem that a deep copy of an array of String (String[]) is not working correctly.


A String[] in java is represented as an array.array with a type code of “java.lang.string” in Jython.

The problem comes up due to the special semantics of the array.array() constructor which needs either a letter (new typecode) or an object as a template.


Deepcopy now uses –straight forward—a java.lang.string object as the template which seems correct for me. Unfortunately the author of array.array() refuses to accept this kind of argument with the error message “array() argument 1 must be char, not str”. So deepcopy-ing a String[] fails.


Unfortunately the String[] is hidden in a structure (HashMap) which is a map of options which are only partly evaluated in the code in questions, most simply must be ignored and passed forward.. So it’s not easy to predict if such an array is there and its existence can not be pinned down to just a few cases. So replacing deepcopy and doing an own conversion is VERY inconvenient at the best.


Does anybody know of a clever workaround for this problem?


Best regards





Gerhard DŁnnebeil
Safety & Security Department

Bitte beachten Sie unseren neuen Firmennamen und neue Kontaktdaten!

Please note our new company name and contact details!
AIT Austrian Institute of Technology GmbH
2444 Seibersdorf | Austria
T +43(0) 50550-3173|  F +43(0) 50550-2813

Gerhard.Duennebeil@ait.ac.at  |  http://www.ait.ac.at

FN: 115980 i HG Wien  |  UID: ATU14703506
This email and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient, please notify the sender by return e-mail or by telephone and delete this message from your system and any printout thereof. Any unauthorized use, reproduction, or dissemination of this message is strictly prohibited. Please note that e-mails are susceptible to change. AIT Austrian Institute of Technology GmbH shall not be liable for the improper or incomplete transmission of the information contained in this communication, nor shall it be liable for any delay in its receipt.