473,320 Members | 2,088 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,320 software developers and data experts.

output on sys.stdout and logfile

Is there a way in which the all the logging done using pexpect can be sent to stdout as well as a file.

eg.
filea = file('output.log',"w")
ssh = pexpect.spawn('ssh root@1.1.1.1')
ssh.logfile = filea
ssh.expect('*assword',timeout=5)
......

In the above script, the output would be stored only in the logfile, is there a way in which it can be even be sent to sys.stdout at the same time.

Thanks
Feb 15 '07 #1
0 1386

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Orr, Steve | last post by:
Oracle provides an export utility (exp) and I have a shell script which compresses its output (not stdout) thru a pipe but l need a platform portable Python script for this. Here's the shell...
3
by: -H | last post by:
Hi, I have a "parent" C program that forks off a "child" C program. Both the parent and the child print information to both stdout and stderr. I would like to redirect the parent and childs...
12
by: Matt Garman | last post by:
I'd like to create a "custom output facility". In other words, I want an object whose use is similar to std::cout/std::cerr, but offers more flexibility. Instead of simply writing the parameter...
5
by: Carl Castrianni | last post by:
When running files containing many sql statements using the db2 command line processor, I`d like to have the output show the time that each sql statement was executed (so I know when they ran). ...
14
by: nathan.shair | last post by:
Hello, I searched on Google and in this Google Group, but did not find any solution to my problem. I'm looking for a way to output stdout/stderr (from a subprocess or spawn) to screen and to...
2
by: Guillaume Dargaud | last post by:
Hello all, a while ago I was pointed towards freopen as a way to redirect stderr to a log file. It works great, but apparently the app also writes a few lines to stdout. Now I could redirect to 2...
5
by: amit.uttam | last post by:
Hey everyone, I've recently jumped big time into python and I'm working on a software program for testing automation. I had a question about proper logging of output. What I would like is: 1....
1
by: Anh Khuong | last post by:
Hi all, I am using pexpect and I want to send output of pexpet to both stdout and log file concurrently. Anybody know a solution for it please let me know. Thanks
0
by: Lie Ryan | last post by:
On Tue, 30 Sep 2008 20:48:12 -0700, Anh Khuong wrote: One way is to create a file-like object that forked the output to stdout and the logfile. class forkwriter(object): def...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.