Sybren Stuvel wrote: > [EMAIL PROTECTED] enlightened us with: > > I want to send thorugh the API. However, no matter how I try it, > > Java on the other end doesn't like what I'm passing it there. > > What have you tried and how did it fail?
See below. > > How can I mimic a byte array in python? > > Strings? OK, I'll put that attempt up front. Here's a couple of tries: <test code snippet> fileobj = open('testfile.txt', mode='r') chararray = fileobj.read() fileobj.close() soap.addAttachmentsToIssue(auth,'TST-4','testfile.txt',chararray) <fails with> SOAPpy.Types.faultType: <Fault soapenv:Server.userException: org.xml.sax.SAXException: Found character data inside an array element while deserializing: <SOAPpy.Types.structType detail at -1216265236>: {'hostname': '<removed>', 'faultData': <SOAPpy.Types.structType faultData at -1216226708>: {'exception': None, 'message': 'Found character data inside an array element while deserializing'}}> <'nother snippet> fileobj = open('testfile.txt', mode='r') chararray = array.array('c') chararray.fromfile(fileobj, stat('testfile.txt').st_size) fileobj.close() soap.addAttachmentsToIssue(auth,'TST-4','testfile.txt',chararray) <fails with> SOAPpy.Types.faultType: <Fault soapenv:Server.userException: org.xml.sax.SAXException: Found character data inside an array element while deserializing: <SOAPpy.Types.structType detail at -1216482740>: {'hostname': '<removed>', 'faultData': <SOAPpy.Types.structType faultData at -1216075252>: {'exception': None, 'message': 'Found character data inside an array element while deserializing'}}> <'nother snippet> fileobj = open('testfile.txt', mode='r') chararray = array.array('c') chararray.fromfile(fileobj, stat('testfile.txt').st_size) #chararray = fileobj.read() fileobj.close() soap.addAttachmentsToIssue(auth,'TST-4','testfile.txt',[chararray]) This one "works" in that it runs, but the server on the other end gets garbage unrelated to the test file. I've tried a few other other ideas including other modes for the array (b/B), but those are the highlights. -- http://mail.python.org/mailman/listinfo/python-list