f



How to get file descriptors of sys.stdin, sys.stdout and sys.stderr? #2

How to get file descriptors of sys.stdin, sys.stdout and sys.stderr?
0
satishmlmlml
11/14/2014 12:54:49 AM
comp.lang.python 77058 articles. 6 followers. Post Follow

1 Replies
3672 Views

Similar Articles

[PageSpeed] 37

On 11/13/14 7:54 PM, satishmlmlml@gmail.com wrote:
> How to get file descriptors of sys.stdin, sys.stdout and sys.stderr?
>

You don't seem to be reading any of the responses you are getting.  At 
the very least, you don't seem to be understanding them, or engaging 
with the authors.  You are misbehaving on this list.

Everyone else: I recommend that people stop responding. Satish seems 
unlikely to improve.

-- 
Ned Batchelder, http://nedbatchelder.com

0
Ned
11/14/2014 1:52:21 AM
Reply:

Similar Artilces:

How to get file descriptors of sys.stdin, sys.stdout and sys.stderr?
How to get file descriptors of sys.stdin, sys.stdout and sys.stderr? On 11/13/2014 7:51 PM, satishmlmlml@gmail.com wrote: in 4 different threads > How to get file descriptors of sys.stdin, sys.stdout and sys.stderr? > fileno() in not supported. Is it only in 3.1? What is the workaround? > io.UnsupportedOperation: fileno > How to give a file descriptor number to this function? How to get a file descriptor number? Satish, you are acting like the variety of troll called a Help Vampire. One of the symptoms is hogging the newsgroup by starting multiple threads a da...

Getting the encoding of sys.stdout and sys.stdin, and changing it properly
My headache is growing while playing arround with unicode in Python, please help this novice. I have chosen to divide my problem into a few questions. Python 2.3.4 (#1, Feb 2 2005, 12:11:53) [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2 1) Does " >>>print 'hello' " simply write to sys.stdout? 2) Exactly what does the following line return? >>> sys.stdout.encoding 'ISO-8859-1' Is it the encoding of the terminal? I think not, because when I change the encoding in my terminal the result is still the same. Is it the encoding of the string p...

sys.stdout vs. sys.stderr
In Python 3.1 is there any difference in the buffering behavior of the initial sys.stdout and sys.stderr streams? They are both line_buffered and stdout doesn't seem to use a larger-grain buffering, so they seem to be identical with respect to buffering. Were they different at some earlier point in Python's evolution? > In Python 3.1 is there any difference in the buffering behavior of the > initial sys.stdout and sys.stderr streams? No. > Were they different at some earlier point in Python's evolution? That depends on the operating system. These us...

What are files Z80.SYS, Z80CCP.SYS and PRMTVPVT.SYS for?
Had a good Christmas this weekend? I came across diskettes with "Mailmerge 3.0 and Calcstar version 1.45 for CP/M 8080", that seem to be for a Dec Rainbow machine. Besides a Mailmerge overlay and the Calcstar files, some CP/M and some CP/M-86 files, there are three files on the diskettes that I never have heard of before: Z80.SYS, Z80CCP.SYS and PRMTVPVT.SYS. There are no ASCII texts in PRMTVPVT.SYS. The only ASCII text in Z80.SYS (at the end of the file) is "EI SPHLDI XCHGPCHLXTHLRET HLT CMC STC CMA DAA RAR RAL RRC RLC NOP CPI ORI XRI ANI SBI IN SUI OUT ACI ADI CALLJMP LDA...

sys.stdout / sys.stderr, subprocess, redirection
Hello, I have a piece of code that gets run in a script that has its stdout closed: import sys sys.stdout = sys.stderr c = subprocess.Popen (..., stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.STDOUT) and this is what I get: Sending SVNR/permissions Transmitting file data .svn: Commit failed (details follow): svn: 'pre-commit' hook failed with error output: Traceback (most recent call last): (...) File ".../__init__.py", line 40, in run stderr...

Buffering of sys.stdout and sys.stderr in python3 (and documentation)
Hi all, Short version: I'm a bit confused in general as to the changes between python2 and python3 regarding how standard output and standard error do buffering. A few things seem to have changed and I've failed to find any documentation of how and why. Also, the meaning of "python -u" seems to have changed and the docs don't seem to reflect the new behaviour (and I can't find any docs about the change either)... Long version: From rude experiment it seems that: 1) In Python 2.x, standard error was always unbuffered while standard output was buffered by default. ...

Making `logging.basicConfig` log to *both* `sys.stderr` and `sys.stdout`?
Hi, I use python oftentimes to write automation scripts on Linux servers. And there's a big pattern in my scripts: - I *always* use `logging` instead of `print` statements. - I *always* create two stream handlers. One for `sys.stdout` with level `INFO` and one for `sys.stderr` with level `WARN` Well, the levels may variate occasionally, but that's only the rare exception. The reason I do this is simple: Most automation tasks are run via cron. With this setup, I can redirect `stdout` to `/dev/null` and still receive e-mails if things go wrong. And having two handlers gives me more ...

Interactive remote debugging by redirecting sys.stdin and sys.stdout to a socket or pipe
Hi I want a simple way to interactively remote debug a running python script which has no tty terminal attached to it. The scripts are running standalone (i.e. they are automatically started and have no terminal) and very infrequently come into error conditions which i want to understand and debug. The idea is that I do the debugging as shown below. Is that a good way of solving my problem? Do I need anything special for terminal emulation? What type of client should I use? I want things like tab completion and syntax coloring of ipshell (or similar) to work. if <condition>: # If ...

sys.stderr.write and sys.exit
Is the same use _sys.stderr.write('error message'); sys.exit(1)_ than _sys.exit('error message')_ ? Note: help(sys.exit) If the status is omitted or None, it defaults to zero (i.e., success). If the status is numeric, it will be used as the system exit status. If it is another kind of object, it will be printed and the system exit status will be one (i.e., failure). "GinTon" <jonas.esp@googlemail.com> writes: > Is the same use _sys.stderr.write('error message'); sys.exit(1)_ > than _sys.exit('error message')_ ? (Note: The underscore &...

KeyboardInterrupt close failed in file object destructor: sys.excepthook is missing lost sys.stderr
Code ################################# #!/usr/bin/env python import sys, re def find_position(line): pun = "" if re.search(r"[.?!]+", line): pun = re.search(r"[.?!]+", line).group() pos = line.find(pun) pos = pos+len(pun)-1 return pos def sentence_splitter(filename): f = open(filename, "r") for line in f: line = line.strip() print line + "\n" while line: pos = find_position(line) line2 = line[ : pos+1].split(" ") length = len(line2) last_word = line2[length -1] try: if re.search(r"[A-Z]+.*", last_word) or line[pos+1] != " " or line[pos+2].islower() : print line[:pos+1], line = line[pos+1:] else: print line[ : pos+1] line = line[pos+1 :] except : print " error here!!" f.close() return " bye bye" if __name__=="__main__": print sentence_splitter(sys.argv[1]) ##########################3 exicution python sentence_splitter6.py README | more ############### README Mr. Smith bought example.cheapsite.com for 1.5 million dollars, i.e. he paid a lot for it. Did he mind? Adam Jones Jr. thinks he didn't. In any case,...

How does Python get the value for sys.stdin.encoding?
I thought it was hard-coded into the Python executable at compile time, but that is apparently not the case: [ron@mickey:~]$ python Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys;print sys.stdin.encoding UTF-8 >>> ^D [ron@mickey:~]$ echo 'import sys;print sys.stdin.encoding' | python None [ron@mickey:~]$ And indeed, trying to pipe unicode into Python doesn't work, even though...

Re: SYS$SPECIFIC and SYS$COMMON not enough? #2
> How weird - we did this as a different excercise to do upgrades off > line on the read only stuff, and swap it back in quickly. We also have > a third party product root to keep our own/third party stuff out of > SYS$SYSDEVICE:[VMS$COMMON...] tree, like a "/usr/local...". > > H sh lo sys$sysroot > "SYS$SYSROOT" = "$9$DKA0:[SYS0.]" (LNM$SYSTEM_TABLE) > = "SYS$COMMON:" > 1 "SYS$COMMON" = "CLU$COMMON:" (LNM$SYSTEM_TABLE) > = "VMS$COMMON:" > = "OUR$COMMON:&...

sys
Dear Friend, I have found some websites: for msn messenger, http://www.hotmailpk.com/ For entertainment,spotlight.articles,interviews,dailyupdate htttp://www.familyandtwist.com/ for sms messeges, smsjokes, http://www.smstwist.com/ for articles,entertainment,beauty tips,news,showbiz and fashion http://http://www.familypk.com Visit these websites: Thanks ...

sys
computer common oriented http://www.freewebs.com/buildem/ http://amigos.com/go/g904313-pmem ...

sys
Is it OT here to talk about IPC and pipes? Or are all aspects of kernle programming ok here? Bill Bill Cunningham <nospam@nspam.com> wrote: > Is it OT here to talk about IPC and pipes? Or are all aspects of kernle > programming ok here? If you want to discuss how IPC and pipes are implemented in the kernel it's completely ok. But if you're interested in how to use IPC or pipes from a userland program then posting to e.g. comp.unix.programmer or comp.os.linux.development.apps will probably make a lot more sense. R...

SimpleXMLRPCServer clobbering sys.stderr? (2.5.2)
I was having a mysterious problem with SimpleXMLRPCServer. (I am using Python 2.5.2) The request handlers were sometimes failing without any error message to the log output. What I discovered was perplexing. I had some 'print' statements in the handers that, assuming the request would be handled, would print just fine. When I switched to 'print >> sys.stderr', the request handlers would just fail completely, and not make the sys.stderr output that I desired. It seems that SimpleXMLRPCServer is clobbering stderr in some bizarre and silent-error-causing way. I can't r...

missing include files (sys/param.h, sys/socket.h, net/if.h, ...)
Hi I'm using VC++ 6.0 SP5 under windows 2k. I tried to compile the net-snmp (sourceforge.net) source. When I try to compile, I get the following errors (missings): Cannot open include file: 'sys/param.h' Cannot open include file: 'sys/socket.h' Cannot open include file: 'net/if.h' Can somebody help me? Thanks Ronald Meier wrote: > Hi > > I'm using VC++ 6.0 SP5 under windows 2k. I tried to compile the net-snmp > (sourceforge.net) source. > When I try to compile, I get the following errors (missings): > > Cannot open include file: ...

missing include files (sys/param.h, sys/socket.h, net/if.h, ...)
Hi I'm using VC++ 6.0 SP5 under windows 2k. I tried to compile the net-snmp (sourceforge.net) source. When I try to compile, I get the following errors (missings): Cannot open include file: 'sys/param.h' Cannot open include file: 'sys/socket.h' Cannot open include file: 'net/if.h' Can somebody help me? "Ronald Meier" <meier1@hta-bi.bfh.ch> wrote in message news:bn5atd$bg6$1@rex.ip-plus.net... > I'm using VC++ 6.0 SP5 under windows 2k. I tried to compile the net-snmp > (sourceforge.net) source. > When I try to com...

question about sys.exc_type and sys.exc_value
Here is an exercise from Learning Python that I wrote myself: import sys import traceback class MyError: pass def oops(): raise MyError() def safe(func, *args): try: apply(func, args) except: traceback.print_exc() print 'Got', sys.exc_type, sys.exc_value safe(oops) And here is the output: Traceback (most recent call last): File "C:/Python24/oops.py", line 11, in safe apply(func, args) File "C:/Python24/oops.py", line 7, in oops raise MyError() MyError: <__main__.MyError instance at 0x00B475A8> Go...

com.sys & vcom.sys
It's been a while since I last installed 1.1 and when I did it yesterday I forgot to de-select Ray Gwinn's com drivers. After installation I removed the entries from config.sys and un-remmed com.sys and vcom.sys but they won't load. I checked and it's in c:/os2/boot. What's the cure? :-) Wayne -- While the e-mail address in this post is genuine it is only used as a spamtrap. Any mail sent to me at this address will be considered to be spam and deleted without being read. Wayne wrote: > It's been a while since I last installed 1.1 and when I > did it yesterday I...

Win98 IO.SYS / JO.SYS
Does anyone happen to know how many sectors or clusters are loaded of IO.SYS (or JO.SYS, if it's different), under Win98? is there a limit to the number of clusters that get loaded? or is the whole chain loaded? i know that execution begins at 0070:0200... (as opposed to MSDOS v6.22, starting IO.SYS execution at 0070:0000) ...i'm just trying to figure out how much code i can pack into JO.SYS before i have to start loading something else off of the disk... i don't want to have to worry about the disk for the time being... thanks in advance Bx.C Bx. C wrote: > Does anyone ha...

SYS$SPECIFIC and SYS$COMMON not enough?
Basically, the idea is that stuff specific to a given node will be in its SYS$SPECIFIC directory and stuff common to all nodes (satellites or not) booting from the same system disk will be in SYS$COMMON. A good idea as far as it goes, but does it go far enough? In particular, there are two additional categories, which I'll give the obvious names SYS$CLUSTER and SYS$WORLD. SYS$CLUSTER would include stuff common to all nodes in a cluster, i.e. would differ from SYS$COMMON if there is more than one system disk in the cluster. The obvious place for this stuff is somewhere which is not ...

SYSMAN: No SYS$SCRATCH/SYS$LOGIN ?
$ mc sysman SYSMAN> set env/node=velo %SYSMAN-I-ENV, current command environment: Individual nodes: VELO Username JFMEZEI will be used on nonlocal nodes SYSMAN> do show log sys$scratch %SYSMAN-I-OUTPUT, command execution on node VELO %SHOW-S-NOTRAN, no translation for logical name SYS$SCRATCH SYSMAN> There is also no SYS$LOGIN defined. (VAX 7,3 and Alpha 8.3) What is the reason behind the lack of those logicals ? JF Mezei wrote: > $ mc sysman > SYSMAN> set env/node=velo > %SYSMAN-I-ENV, current command environment: > Individual nodes:...

FYI Sys Shock and Sys Shock2
Up in a.b.games now "Legion" <Legion@Invalid.com> wrote in message news:juphu55oonf2bfc4r2h1gnr9nb41eab1aa@4ax.com... > Up in a.b.games now If I want to play them again, I'm more than capable of buying them again. Thanks. On Tue, 11 May 2010 15:37:18 +0100, "CJM" <cjmuk2008@gmail.removethis.com> wrote: >"Legion" <Legion@Invalid.com> wrote in message >news:juphu55oonf2bfc4r2h1gnr9nb41eab1aa@4ax.com... >> Up in a.b.games now > >If I want to play them again, I'm more than capable of buying them ag...

Web resources about - How to get file descriptors of sys.stdin, sys.stdout and sys.stderr? #2 - comp.lang.python

Descriptor - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Israel descriptor sparks boycott threat
ISLAMIC nations furious over the Abbott government's policy shift on Israeli settlements have warned they could boycott Australian farm exports ...

Wine: Flavour descriptors move to bottles' front labels
in a bold move, some wine producers have started printing flavour information prominently on the front

Most SBC Pastors Reluctant to Use 'Great Commission Baptists' Descriptor
Contrary to the recent recommendation by a Southern Baptist Convention task force that the denomination introduce an "informal" optional title ...

A Quite Recent Obsession: On Constitutional Descriptors
... describe things as “constitutional,” and “unconstitutional.” They talk about the “Bill of Rights” and the “Second Amendment.” These descriptors ...

CinemaCon: MPAA And NATO Chiefs Talk Up New Ratings Descriptors
The film industry’s two chief lobbyists stayed on message at a brief press conference this afternoon that mostly dealt with the movie ratings ...

‘Middle Class’ Disappears: Political Strategists Use ‘Everyday Americans’ As A New Descriptor For The ...
... with family and friends on holidays. But that reality has quickly dissipated; what is left in its wake has yet to be named an accurate descriptor. ...

Why the Word ‘Merry’ Is Used For Christmas in the U.S. When Other Holidays Use the Descriptor ‘Happy’ ...
Linguist Arika Okrent and illustrator Sean O’Neill verbally and visually explain why the word “merry” is used in conjunction with Christmas , ...

Body, Structure, Grip: What Wine Descriptors Really Mean
Whether you're reading off a list, getting an expert's recommendations, or browsing the aisles of a liquor store, it's rare to talk about wine ...

New Yorker Deletes ‘Uppity’ Descriptor from Ted Cruz Article
The New Yorker’ s John Cassidy used the word “uppity” to describe Senator Ted Cruz (R-TX) in an article on the early GOP presidential hopeful ...

Resources last updated: 3/6/2016 4:21:55 PM