The message type is bytes, this may make different ?
print(type(message))
On Sun, Jan 28, 2018 at 8:41 PM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:
> On Sun, 28 Jan 2018 20:31:39 -0500, Jason Qian via Python-list wrote:
>
> > Thanks a lot :)
> >
> > os.write(1,
On Sun, Jan 28, 2018 at 6:04 PM, Steven D'Aprano
wrote:
> On Sun, 28 Jan 2018 17:49:44 -0800, Dan Stromberg wrote:
> So what was the clue that it was bytes that you saw that (nearly)
> everyone else missed? Especially me.
Can I get away with saying "it was
On Sun, 28 Jan 2018 17:49:44 -0800, Dan Stromberg wrote:
> On Sun, Jan 28, 2018 at 5:35 PM, Steven D'Aprano
> wrote:
>> On Sun, 28 Jan 2018 17:04:56 -0800, Dan Stromberg wrote:
>>> How about:
>> os.write(1, message)
>>
>> What do you think that will do
On Sun, 28 Jan 2018 19:51:06 -0500, Jason Qian via Python-list wrote:
> print(repr(message)) out :
>
> *does not exist\r\n\tat com.*
For the record, I'd just like to say that this is not the output of
Jason's call to print(). It has been edited to remove the
b' '
delimiters which would
On Sun, Jan 28, 2018 at 5:35 PM, Steven D'Aprano
wrote:
> On Sun, 28 Jan 2018 17:04:56 -0800, Dan Stromberg wrote:
>> How about:
> os.write(1, message)
>
> What do you think that will do that print() doesn't do?
>>> message = b'*does not exist\r\n\tat
On Sun, 28 Jan 2018 20:31:39 -0500, Jason Qian via Python-list wrote:
> Thanks a lot :)
>
> os.write(1, message) works !
I still do not believe that print(message) doesn't work. I can see no
reason why you need to use os.write().
--
Steve
--
On Sun, 28 Jan 2018 17:04:56 -0800, Dan Stromberg wrote:
> How about:
os.write(1, message)
What do you think that will do that print() doesn't do?
--
Steve
--
https://mail.python.org/mailman/listinfo/python-list
Jason, your Python output and the C output are not the same.
Also, it looks like your email client is adding formatting codes to the
email, or something. Please look at your post here:
https://mail.python.org/pipermail/python-list/2018-January/730384.html
Do you notice the extra asterisks
Thanks Peter,
replace print with os.write fixed the problem.
On Sun, Jan 28, 2018 at 3:57 AM, Peter Otten <__pete...@web.de> wrote:
> Jason Qian via Python-list wrote:
>
> > HI
> >
> >I have a string that contains \r\n\t
> >
> >[Ljava.lang.Object; does not exist*\r\n\t*at
> >
Thanks a lot :)
os.write(1, message) works !
On Sun, Jan 28, 2018 at 8:04 PM, Dan Stromberg wrote:
> How about:
> >>> os.write(1, message)
>
> On Sun, Jan 28, 2018 at 4:51 PM, Jason Qian via Python-list
> wrote:
> > print(repr(message)) out :
> >
How about:
>>> os.write(1, message)
On Sun, Jan 28, 2018 at 4:51 PM, Jason Qian via Python-list
wrote:
> print(repr(message)) out :
>
> *does not exist\r\n\tat com.*
>
>
> for ch in message:
> printf("%d %c",ch, chr(ch))
>
>
> %d %c 110 n
> %d %c 111 o
> %d %c 116 t
>
print(repr(message)) out :
*does not exist\r\n\tat com.*
for ch in message:
printf("%d %c",ch, chr(ch))
%d %c 110 n
%d %c 111 o
%d %c 116 t
%d %c 32
%d %c 101 e
%d %c 120 x
%d %c 105 i
%d %c 115 s
%d %c 116 t
*%d %c 13%d %c 10*
*%d %c 9*
%d %c 97 a
%d %c 116 t
%d %c 32
%d %c 99 c
%d %c
On Sat, 27 Jan 2018 21:23:02 -0500, Jason Qian via Python-list wrote:
> there are 0D 0A 09
If your string actually contains CARRIAGE RETURN (OD) NEWLINE (OA), and
TAB (09) characters, then you don't need to do anything. Just call print,
and they will be printed correctly.
If that doesn't
Jason Qian via Python-list wrote:
> HI
>
>I have a string that contains \r\n\t
>
>[Ljava.lang.Object; does not exist*\r\n\t*at
>[com.livecluster.core.tasklet
>
>
>I would like to print it as :
>
> [Ljava.lang.Object; does not exist
> tat com.livecluster.core.tasklet
>
On Saturday, January 27, 2018 at 8:16:58 PM UTC, Jason Qian 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
In python 3. X
Use. Decode and. Encode
On 28 Jan 2018 1:47 am, "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 :
>
>
there are 0D 0A 09
%c %d 116
*%c %d 13%c %d 10%c %d
9*
%c %d 97
On Sat, Jan 27, 2018 at 9:05 PM, Dennis Lee Bieber
wrote:
> On Sat, 27 Jan 2018 20:33:58 -0500, Jason Qian via Python-list
> declaimed the following:
>
> >
Thanks for taking look this.
The source of the string is std::string from our c code as callback .
On the python side is shows as bytes.
Is there way we can reformat the string that replace \r\n with newline, so
python can correctly print it ?
Thanks
On Sat, Jan 27, 2018 at 5:39 PM, Terry
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
On 1/27/2018 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
Your output
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
HI
I have a string that contains \r\n\t
[Ljava.lang.Object; does not exist*\r\n\t*at com.livecluster.core.tasklet
I would like to print it as :
[Ljava.lang.Object; does not exist
tat com.livecluster.core.tasklet
How can I do this in python print ?
Thanks
On Sat, Jan 27,
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
--
https://mail.python.org/mailman/listinfo/python-list
23 matches
Mail list logo