嗨,
我有一个上传.csv文件中的发票数据到OTM(GLOG)系统的Python脚本.我使用下面的命令(如下所示)运行该脚本,使用一个外壳脚本并将输出捕获到一个文件(我们将其称为日志).
Python TestInvoiceTransform.py-glUserGid-glPassword-inputFileName TestInvoice.csv-host name-mailto-smtphost amermsx.med.ge.com>test.log
当传输正确时,输出将很好地发送到文件.但当传输失败时,实际的错误消息不会写入日志文件.我可以在控制台上看到此错误消息,但不能记录在我的日志文件中.
在这方面,有人能帮我吗?
在这方面的任何帮助都是非常感谢的.
非常感谢,
吉特恩德
# 回答1
这句话应该能做到这一点:
- stdin
- stdout
- stderr
- 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.)
# 回答2
那真是太棒了.
它成功了...
非常感谢