LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-02-2012, 02:43 PM   #1
sahana12
LQ Newbie
 
Registered: Aug 2012
Location: Bangalore
Posts: 4

Rep: Reputation: Disabled
How to avoid stdin into logging in python


I am running python file which logins to remote machine1 and run some commands and logins to remote machine2 and run same commands. Capture the outputs into a logfile(using logging).It also compares output and say pass or fail.

But when those commands are getting executed, if I press enter any key , even that will be logged. Hence it makes difference in output , which leads to testcase fail even though its pass.

command ran : for i in {1..10} ; do sleep 1;ls file1 2&> /dev/null; done;ls file1;

While this was executed ,pressed key enter, 444

logfile:

running on machine1...
ls: file1: No such file or directory
running on machine2...
444^M
^M
^M
^M
^M
^M
^M
ls: file1: No such file or directory^M
testcase failed

Last edited by sahana12; 11-02-2012 at 02:48 PM. Reason: output was wrong
 
Old 11-03-2012, 02:28 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
I don't see any source code here, so I'm not sure how anyone is supposed to help debug. Does your program read from stdin? Open FDs?
 
Old 11-03-2012, 04:18 PM   #3
sahana12
LQ Newbie
 
Registered: Aug 2012
Location: Bangalore
Posts: 4

Original Poster
Rep: Reputation: Disabled
No I am not taking any input from stdin.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
trouble using stdin/pipelines/python rich123 Linux - Newbie 5 10-14-2012 07:51 PM
How to avoid logging with root user? pinga123 Linux - Newbie 4 07-23-2010 04:11 AM
python: reading from stdin with a timeout eantoranz Programming 6 07-09-2009 04:00 PM
Python: Stdin and python apps fighting? enigma_0Z Programming 2 07-15-2008 08:45 AM
Logging via stdin bubblenut Linux - Server 4 02-12-2007 12:00 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration