stdout

Windows/WinXP CMD: How to pipe the output of a script to a log file AND display output?

落爺英雄遲暮 提交于 2019-12-12 04:39:21
问题 I'm running python scripts from cmd. I am currently piping the output of the script to a log file that I specify. However, I would also like to be able to visually monitor the progress of the execution by watching output scroll. I'm piping to a log file because the window buffer is not sufficiently long to contain the entire log. However, the only way to get instant feedback of the current state of the execution is to keep refreshing the log file by opening it. Can you suggest a better way to

ipython redirect stdout display corruption

大兔子大兔子 提交于 2019-12-12 04:36:10
问题 I'm developing a system in python, and one functionality I need is the ability to have console output go to both the console and a user-specified file. This is replicating the Diary function in MATLAB. I have the following that works perfectly well on both IDLE on windows and python cmdline in ubuntu (this all exists inside a module that gets loaded): class diaryout(object): def __init__(self): self.terminal = sys.stdout self.save = None def __del__(self): try: self.save.flush() self.save

Swift stderr and stout into single file

强颜欢笑 提交于 2019-12-12 04:23:04
问题 For an iPhone app, I need to collect debugging data into a file to be sent to an online service for analysis. This works fine by diverting the stderr output to a file handle and sending the file when appropriate. ( NSLog output also ends up in stderr , so this works across the board.) The same method also works fine with stdout . Here is how I do the saving to a file: freopen(cStringFilePath, "a+", stderr) // or stdout The above correctly returns a UnsafeMutablePointer<FILE> which I keep

Command line stdout to array in nodejs

匆匆过客 提交于 2019-12-12 03:59:41
问题 I am trying to write a node.js application to interface with docker command line tool. My current code is as below: #!/usr/bin/env node var child_process = require('child_process'); child_process.exec('docker ps -a', function(error, stdout, stderr){ console.log(stdout); }); I get a sample output as below: safwan@ubuntu:~/node$ ./cmd-docker.js CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e855320e9547 wadmiraal/drupal "/bin/sh -c 'exec sup" 2 weeks ago Exited (137) 12 days ago 3306/tcp

Redirect stdout to a variable while requiring other script

谁说胖子不能爱 提交于 2019-12-12 03:37:57
问题 I'm trying to redirect STDOUT to a variable, which seems to work fine. However, when I'm requiring other script, its expected output is not stored in that variable. my $var; #save STDOUT for future redirect open OLDOUT, '>&STDOUT'; close STDOUT; # redirect STDOUT to $var open STDOUT, '>', \$var or die "Can't open STDOUT: $!"; # run the script that I'm supposed to catch its output do("macro.pl"); close STDOUT; # redirect STDOUT to its original FH open STDOUT, '>&OLDOUT' or die "Can't restore

How to process raw data (in python)? [closed]

孤者浪人 提交于 2019-12-12 03:27:52
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . ***I'm not explaining this well so hopefully this edit makes more sense: basically I have to write code that will work for a ton of test cases, the input below is just an example. So I can't manually enter the input into my function Say I have the following input: 0 4 0,2,2,3 and I need to generate some sort of

Why are FireWarning and FireError working but FireInformation is not?

吃可爱长大的小学妹 提交于 2019-12-12 03:15:25
问题 I've got a .bat script that calls an SSIS package via dtexec and redirects the output to a log file: CALL dtexec.exe /f Package.dtsx >> logfile.txt We don't have separate logging configured within the package since anything sent to standard out is captured in this way. This is usually enough but I'm now trying to write some custom log messages using Dts.Events.FireInformation . However, these messages are not showing up in the output at all. If I use FireWarning or FireError then both appear

Input only to bottom line of terminal

倖福魔咒の 提交于 2019-12-12 03:13:09
问题 I made a command-line chat client with Java, that sends the messages from stdin to the server and, at the same time, receives messages from the server to stdout at the same time. It's likely that somebody may send a message while you're writing one, so I want the bottom line of the terminal always reserved for input, so that output appears above it. I hope you understand my question and I apologize in advance if you don't. 回答1: The JCurses library will do exactly what you need. http:/

Python subprocess PIPE blocking

夙愿已清 提交于 2019-12-12 02:54:29
问题 The subprocess will output several characters, and I want to send some response via stdin. The length of the output is predictable, so I wrote code like this: p = Popen("myproc", shell = True, stdin = PIPE, stdout = PIPE) p.stdout.read(1) However, p.stdout.read(1) doesn't return even if the process had already output more than a character. How can I make it stop blocking after reading a byte sequence of the expected length? 回答1: myproc may use a block-buffering mode when the standard output

WebLogic: Getting Standard Error Into A File

拟墨画扇 提交于 2019-12-12 02:44:42
问题 I'm using WebLogic 9.2. I found an option in the Admin Server web page to send standard out to the server log files. I would like the same for standard error, but I can't find an option for it in the Admin Server web page. I haven't found Oracles documentation very clear. Do I need to set this option by hand in a config file somewhere and if so where and how? Thanks in advance 回答1: If you are using 'RedirectStdoutToServerLogEnabled' feature as described in http://download.oracle.com/docs/cd