Please help on print string that contains 'tab' and 'newline'

Jason Qian jqian at tibco.com
Sat Jan 27 20:33:58 EST 2018


Thanks for taking look this.

1. Python pass a function to c side as callback, and print out the message.

def handleError(message, code):
 print('** handleError **')
* print('exception ' + str(message))*

2. On c side : send stack trace back to python by calling the callback
function

Callback::Callback(InvocationER rcb)
:
_rcb(rcb)
{
}
void Callback::handleError(Exception &e, int taskId) {
 *(_rcb)((char*)e.getStackTrace().c_str(), taskId);*
}


So, the source of the string is std::string. On the python side is byte
array.

      Ljava.lang.Object; does not exist*\r\n\t*at com

Thanks




On Sat, Jan 27, 2018 at 4:20 PM, Ned Batchelder <ned at nedbatchelder.com>
wrote:

> On 1/27/18 3:15 PM, Jason Qian via Python-list wrote:
>
>> HI
>>
>>     I am a string that contains \r\n\t
>>
>>     [Ljava.lang.Object; does not exist*\r\n\t*at
>> com.livecluster.core.tasklet
>>
>>
>>     I would like it print as :
>>
>> [Ljava.lang.Object; does not exist
>>    tat com.livecluster.core.tasklet
>>
>
> It looks like you are doing something that is a little bit, and perhaps a
> lot, more complicated than printing a string.  Can you share the code that
> is trying to produce that output?
>
> --Ned.
> --
> https://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list