467,104 Members | 1,141 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,104 developers. It's quick & easy.

Python / Shell script output (log) capturing

Hi,

I have a Python script to upload the Invoice data which is in .csv file to OTM (GLOG) system. I'm running this script using the command(given below) using a shell script and capturing the output to a file (which we are refering as a log).


python TestInvoiceTransform.py -glUserGid <user> -glPassword <password> -inputFileName TestInvoice.csv -hostname <host url> -mailto <mail id> -smtphost amermsx.med.ge.com > test.log

The output is going to the file fine when the transmission is correct. But when the transmission fails, the actual error message is not going to the log file. I'm able to see this error message on the console, but not getting in my log file.

Can any one help me in this regard.

Any help on this is greatly appreciated.

Thanks much,
Jithender
Feb 4 '08 #1
  • viewed: 2686
Share:
2 Replies
This sentence should achieve that:
Expand|Select|Wrap|Line Numbers
  1. sys.stderr = sys.stdout

Expand|Select|Wrap|Line Numbers
  1. stdin 
  2. stdout
  3. stderr
  4. File objects corresponding to the interpreter's standard input, output and error streams. stdin is used for all interpreter input except for scripts but including calls to input() and raw_input(). stdout is used for the output of print and expression statements and for the prompts of input() and raw_input(). The interpreter's own prompts and (almost all of) its error messages go to stderr. stdout and stderr needn't be built-in file objects: any object is acceptable as long as it has a write() method that takes a string argument. (Changing these objects doesn't affect the standard I/O streams of processes executed by os.popen(), os.system() or the exec*() family of functions in the os module.) 
Feb 4 '08 #2
That was great...
It worked...
Thanks much
Feb 5 '08 #3

Post your reply

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

Similar topics

20 posts views Thread by Matthew Thorley | last post: by
4 posts views Thread by cepl@surfbest.net | last post: by
10 posts views Thread by Andrew Dalke | last post: by
8 posts views Thread by Harlin Seritt | last post: by
4 posts views Thread by vagrantbrad@yahoo.com | last post: by
4 posts views Thread by Layne Meier | last post: by
16 posts views Thread by diffuser78@gmail.com | last post: by
3 posts views Thread by koutoo@hotmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.