473,394 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

howto run a function w/o text output?

hi all,
I have a
y = some_func(args)
statement, and the some_func() produces lots of text output. Can I
somehow to suppress the one?
Thx in advance, D.

Jun 22 '07 #1
3 5440
dmitrey schrieb:
hi all,
I have a
y = some_func(args)
statement, and the some_func() produces lots of text output. Can I
somehow to suppress the one?
Thx in advance, D.
Either rewrite it or pipe sys.stdout to some other file-like object but
your console while running it. The StringIO
(http://docs.python.org/lib/module-StringIO.html) module might help.
Jun 22 '07 #2
On Jun 22, 9:56 am, dmitrey <open...@ukr.netwrote:
hi all,
I have a
y = some_func(args)
statement, and the some_func() produces lots of text output. Can I
somehow to suppress the one?
Thx in advance, D.
Expand|Select|Wrap|Line Numbers
  1. import sys
  2. import os
  3.  
  4. sys.stdout = open(os.devnull,"w")
  5.  
Jun 22 '07 #3
On 6/22/07, dmitrey <op*****@ukr.netwrote:
hi all,
I have a
y = some_func(args)
statement, and the some_func() produces lots of text output. Can I
somehow to suppress the one?
Thx in advance, D.
In addition to the other solutions proposed, on a *nix system you can
do os.close(1); os.close(2) to suppress output to stdout and stderr.

--
Evan Klitzke <ev**@yelp.com>
Jun 22 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: newgene | last post by:
Hi, group, I guess it is a simple question for you, but it puzzles me for a while. I use a wxTextCtrl in my application for output result and any exception msg. I know I can add new msg onto...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
1
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
8
by: Topper | last post by:
Hello. I have simple web folders structure: -ROOT - BIN WebService.dll WebService.asmx I need to use my WebService.dll not in bin folder - for example, in ROOT. How do i this? How can i do...
8
by: mosscliffe | last post by:
I am an old programmer, but a newbie to Visual Web Developer 2005 - Express Edition I have an .aspx Form Page with an attached Master File and an attached css file. I have scanned a text...
3
by: Phoe6 | last post by:
Hi all, I had a filesystem crash and when I retrieved the data back the files had random names without extension. I decided to write a script to determine the file extension and create a newfile...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Make CStr for JavaScript on ASP w/ Request.Form and QueryString In ASP, Request.Form and Request.QueryString return objects that do not support "toString", or any JavaScript string...
12
by: Stef Mientki | last post by:
hello, I need to search a piece of text and make all words that are equal (except their case) also equal in their case, based on the first occurrence. So I'm using a dictionary to store names...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.