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:-
Code:
Help on built-in function write:
write(text, /) method of _io.TextIOWrapper instance
Write string to stream.
Returns the number of characters written (which is always equal to
the length of the string).
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'.
Code:
Last login: Tue Mar 7 08:59:58 on ttys000
AMIGA:amiga~> python3.5
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 26 2016, 10:47:25)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import sys
>>> TEXT="Some string.\n"
>>> sys.stdout.write(TEXT)
Some string.
13
>>> help(sys.stdout.write)
>>> STRLENGTH=sys.stdout.write(TEXT)
Some string.
>>> print(STRLENGTH)
13
>>> len(TEXT)
13
>>> exit()
AMIGA:amiga~> _
Now solved and my mind is at rest.
This User Gave Thanks to wisecracker For This Post:
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)
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)
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)
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)
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)
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)
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)
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)
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)
Discussion started by: mohan705
1 Replies
LEARN ABOUT OPENSOLARIS
write
write(9E) Driver Entry Points write(9E)NAME
write - write data to a device
SYNOPSIS
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/open.h>
#include <sys/cred.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
int prefixwrite(dev_t dev, struct uio *uio_p, cred_t *cred_p);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). This entry point is optional.
PARAMETERS
dev Device number.
uio_p Pointer to the uio(9S) structure that describes where the data is to be stored in user space.
cred_p Pointer to the user credential structure for the I/O transaction.
DESCRIPTION
Used for character or raw data I/O, the driver write() routine is called indirectly through cb_ops(9S) by the write(2) system call. The
write() routine supervises the data transfer from user space to a device described by the uio(9S) structure.
The write() routine should check the validity of the minor number component of dev and the user credentials pointed to by cred_p, if per-
tinent.
RETURN VALUES
The write() routine should return 0 for success, or the appropriate error number.
EXAMPLES
The following is an example of a write() routine using physio(9F) to perform writes to a seekable device:
static int
xxwrite(dev_t dev, struct uio *uiop, cred_t *credp)
{
int instance;
xx_t xx;
instance = getminor(dev);
xx = ddi_get_soft_state(xxstate, instance);
if (xx == NULL)
return (ENXIO);
return (physio(xxstrategy, NULL, dev, B_WRITE,
xxmin, uiop));
}
SEE ALSO read(2), write(2), read(9E), physio(9F), cb_ops(9S), uio(9S)
Writing Device Drivers
SunOS 5.11 28 Mar 1997 write(9E)