473,383 Members | 1,874 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,383 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 5439
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.