Interactive Python 3.5+ sys.stdout.write() AND sys.stderr.write() bug?
(Apologies for any typos.)
OSX 10.12.3 AND Windows 10.
This is for the serious Python experts on at least 3.5.x and above...
In script format sys.stdout.write() AND sys.stderr.write() seems to work correctly.
Have I found a serious bug in the interactive sys.stdout.write() AND sys.stderr.write() functions in at least Python 3.5.x ?
This is the same in Windows 10 using Python 3.6.0 too, though not tried it in Linux as yet but WIndows 10 and OSX 10.12.3 should suffice.
Where is the '14' coming from?
Well, it looks like it is coming from 'sys.stderr' and corresponds to the length of any string; see below.
Note that the code below is all longhand and my 'echo' does not exist.
Is this a bug or am I missing something?
Can others try this out on various platforms too just to put my sanity at rest. ;o)
After searching the 3.5.x and 3.6.0 documentation and finding absolutely nothing about this someone pointed me to the Python builtin 'help()' function. I never even considered this.
So this is the response:-
So it is the 'write' attribute that causes this event and IS NOT an error.
If this number is not stored into a _variable_ it is printed to 'stdout'.
Now solved and my mind is at rest.
This User Gave Thanks to wisecracker For This Post:
Hi ,
In file first line start with "",when trying to remove using sed i am getting the below error .Please advise
sed -e 's///g' -e 's/$]//g' segment1.txt >>segment_m1
sed: couldn't write 1378 items to stdout: No space left on device
Thanks,
Mohan (1 Reply)
Hi,
I got a process (c written) that we usually run this way :
EmsChkQu >> /EMS/log/EmsChkQu.log 2>&1
When trying to use it as a service I defined it this way :
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle... (6 Replies)
Hello,
As stated in the title, I do some hacked parallel processing by running multiple instances of bash scripts, each in their own subshell. The code looks like this,
# launch one batch-train script in background for each value in fold group list
for FOLD_GROUP in "${FOLD_GROUP_LIST}"
do
... (5 Replies)
Hello everyone, I just want to write a shell script for automatic feeding the username and password prompts when running my commands,
I tried this one but it did not work. Please help me for any way out.
#!/bin/bash
#!/usr/bin/expect
cd ~/workspace/mimosanetworks_mimosa-nms
ls -ltr
... (5 Replies)
Hi,
i am using the below program to read from the standard input or to write to standard out put.
i know that using highlevel functions this can be done better than what i have done here.
i just want to know is there any other method by which i find the exact number of characters ( this... (3 Replies)
Hi,
We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Q. Write a script that behaves both in interactive and non interactive mode. When no arguments are supplied it picks up each C program from the directory and prints first 10 lines.
It then prompts for deletion of the file.
If user supplies arguments with the script , then it works on those files... (8 Replies)
Can anybody help me to write a shell script to login interactive system
once u open a connection using telnet it will ask for
USERCODE:
PASSWORD:
DOMAIN: (1 Reply)
perl 5.6.1 in win2000:
my program uses a subroutine which will write log file. i will call that sub routine like this
&log_message("the file $inputfile opened");
what should i do to write the stderr on the same log file itself..
i tried to pass the stderr to the subroutine like ... (1 Reply)