Questions tagged [stdout]
The standard output stream (stdout) is the stream where a program writes its output data.
4,505
questions
1
vote
0
answers
7
views
Prepending time stamp to stdout
I am having a datetime suffix appended to my stdout for logging reasons in my application.
old_f = sys.stdout
class F:
def write(self, x):
old_f.write(x.replace("\n", " [%s]\...
0
votes
0
answers
15
views
Avoiding deadlock while checking if a directory or file exists by running external command (ls /path/to/file)
lend me some of your time, I'll try to describe my problem and questions as best as I can.
I'll probably mention a few of the points multiple times though, forgive me, it's just too complicated for me ...
0
votes
0
answers
68
views
How to suppress automatically generated output from a Python code?
I want to suppress auto generated output from this line of code:
cp = client.fetch_market_depth(a)["Data"][0]['LastTradedPrice']
Here client.fetch_market_depth() is part of coding API ...
0
votes
0
answers
11
views
How to redirect print/stdout to Tkinter widget with COLOR?
I want to redirect the content of print/loguru (stdout) to tkinter. I can do this with this post.
However, this will lose the color. And I like a colorful output, like the VsCode terminal.
Any ideas? ...
0
votes
1
answer
21
views
Random behaviour while reading from subprocess stdout in a thread
I am writing a script that to start a process and check's its stdout (while it's being run, not at the end of execution).
The obvious choice seemed to have a thread that will be blocked reading lines ...
1
vote
3
answers
54
views
Instantly redirect stdout and stderr from app to file with max size
In my startup script for app on vm I have:
exec /usr/java/latest/bin/java $JAVA_OPTS -jar $JAR_FILE >> /logs/$APP_NAME/startup.out 2>&1 &
This causes issues with the size of the ...
0
votes
1
answer
43
views
How to decode b"\x80" in python?
I want to decode b"\x80" in python (I want to receive "\x80").
When I tried b"\x80".decode(), it gives me UnicodeDecodeError.
But when I tried just "\x80", it ...
0
votes
0
answers
3
views
Unable to pipe output to Bunyan logging
I've been trying to simply output my Node.js programs output to Bunyan logging, yet when I run it I see nothing. I'm not sure what to do, as I've even used the example project from the Bunyan docs.
...
0
votes
5
answers
53
views
Using sys.stdout to save the console output in a txt. file but keep seen the running output on the pycham console
I'm need to save some outputs that I run on the Pycharm. I know that I can use the sys.stdout to do it, but when I use it the pycharm console doesnt't show me anything until the end of the run process ...
1
vote
2
answers
22
views
How to Get Output from a Print Statement of a Black Box Function in Python
Let's say you have a function that you aren't allowed to modify, but you are able to call it. When you call it, how do you retrieve the output from the print statements such that you can store it in a ...
1
vote
1
answer
34
views
Preserve stdout after os/exec.Cmd.Wait()
I'm working with os/exec, sending input and receiving output as a command runs.
I need to store the command's return code when it finishes, so I have a goroutine with err := cmd.Wait(), and I get any ...
-1
votes
0
answers
30
views
stderr and stdout - I am not getting stdout
I am following this guide:
$ ls /fake/directory &> peanuts.txt
And I am not getting both of them in peanuts.txt
My output:
ls: cannot access /fake/directory: No such file or directory
0
votes
0
answers
12
views
My code detects Key Presses in Java but does detect when the key is lifted in StdDraw?
So my project requires me to only use StdIn, StdOut and StdDraw. I have got code to detect when certain keys are pressed but it doesn't stop moving until the boundary is hit. I need it to only move 1 ...
0
votes
0
answers
16
views
Redirect keyboard input echo in linux terminal
So this is a tricky one. After having run matlab in a linux terminal, somehow the echo of keyboard input is lost. That is for example if I type "ls", I don't see "ls" in the ...
0
votes
1
answer
13
views
Dart don't buffer process stdout (tell process that it is running from a terminal)
I'm trying to run a binary file width Process.start in dart and redirect its output the stdout and pipe stdin to the process.
Here is my code:
import 'dart:io';
import 'dart:convert';
main() async {
...
0
votes
0
answers
17
views
Disable Tomcat stdout logging in a specific range of hours
Good morning,
I've tried to check this online, but I've not found a specific solution.
Is it possible to disable tomcat stdout logfile-writing only in a specific time interval? For example disabling ...
1
vote
2
answers
29
views
How do I ask nohup not to redirect stderr to stdout if it is detached from terminal?
This question looks naive but I can't find the answer after half an hour of intensive searching. Basically I do not want stderr messages to sneak into my result file.
$nohup ./a.out | gzip -c > ...
0
votes
1
answer
11
views
Using node.js, I cannot get the stdout from a macos app until the process finishes
I've created a helper app with Xcode. It's a command line app that keeps running using RunLoop (because it will do Bluetooth things in the background).
I want to spawn this app using node.js and read ...
0
votes
0
answers
17
views
Python check stdout while subprocess is running without blocking
I've been reading a lot of threads on this but can't get what I'm looking for working. I'm running a subprocess and output stdout in a pipe. With a while loop I'm then checking multiple parameters ...
0
votes
1
answer
26
views
How can you find out what event a stdout message is coming from? NodeJS
I'm currently working on a script where I want to be able to read the messages coming from child processes spawned from ShellJS NPM package, which uses NodeJS child_process. Currently, I am able to ...
0
votes
1
answer
77
views
Using printf() to output the correct number of decimal places?
When I enter 2, I wish to get this output:
value: 2.4
But when I do the multiplication, I am getting this:
value: 2.400000
This is my code:
#include <stdio.h>
int main()
{
float num;
...
-1
votes
0
answers
44
views
How to read stdin in c++ send from a python script?
I try to run a process written in C++ from a Python script and send/receive some commands. I found this example written in Python 2, which I tried to convert to Python 3:
Source
Python:
import ...
0
votes
2
answers
43
views
Live output with subprocess in Python
I am trying to run a python file that prints something, waits 2 seconds, and then prints again. I want to catch these outputs live from my python script to then process them. I tried different things ...
0
votes
1
answer
37
views
Is there a way to preserve the format of an stdout output and transport it to a file?
With your help, with the help of this community, I managed to get a working code for printing 2 more elements of an array in each row... Thanks to @Ted Lyngmo.
I would like to know, if there exists ...
0
votes
0
answers
30
views
sendling log4j logs in stdout to a file in an openshift container
I am trying to change the log4j properties from stdout to a file and used the below format , but it did not make any difference.I am still getting the logs in stdout not in file. I am not sure if i ...
0
votes
0
answers
18
views
Sending log4j logs in stdout to fluentd container and search logs in splunk
I am trying to send logs(in stdout) from a pod to the fluentd container in it. I a pod i have 2 containers among which 1 is fluentd.
It works if i have a file in fluentd using the command:
@type tail.
...
0
votes
0
answers
14
views
Removing terminal color formatting from text in stdout [duplicate]
This is a follow-up from this post here: tail command not working with nodejs exec command
I finally got the log file output I want but the new challenge is that the formatting from the output that ...
0
votes
1
answer
43
views
Redirecting stdin and stdout using dup2
I'm writing my own custom shell, and as a part of my project, when the program reads either "<" or ">" character from user input, it needs to redirect stdin and stdout to a ...
0
votes
1
answer
19
views
FFmpeg stdout packet size for rawvideo
Is there a way to restrict/enforce packet size for rawvideo output over pipe?
ffmpeg -i video -f rawvideo -vcodec rawvideo -pix_fmt rgba -
So far I tried various arguments like -video_size, -...
0
votes
1
answer
27
views
OpenVPN: client-connect and client-disconnect seem to be working, but won't save data to files
So I got following directives in server.conf:
script-security 2
up "/etc/openvpn/script.sh"
down "/etc/openvpn/script.sh"
client-connect "/etc/openvpn/script.sh"
client-...
0
votes
0
answers
34
views
How do you preserve text from STDIN when you print to STDOUT?
I'm writing a chat program, and I'm running into an issue involving STDOUT and STDIN. Essentially, while a client is typing something out, if the client receives some text from the server, it "...
0
votes
0
answers
30
views
TQDM - Last progress bar update missing if multiple progress bars used in a single loop
I have a code where two generators that run with tqdm are zipped and looped through together which results in two progress bars being printed to stdout. Both are updated tracking the progress, but ...
0
votes
0
answers
23
views
Python substitute sys.stdout causes mypy error
I have the following class:
class Unbuffered:
def __init__(self, stream, logfile):
self.stream = stream
self.logfile = logfile
def write(self, data):
if self.stream is ...
1
vote
0
answers
32
views
Capture python stdout in real time
I have a GUI program guy.py (that uses tkinter) and a command line script script.py. I want to launch the script from the program and write its output to a textbox in the GUI. Because the script takes ...
0
votes
2
answers
44
views
bash console output print layout
I want to make my writing to the console output in a nice tidy human readable.
here is how it looks now:
====================== Sat Apr 16 12:57:17 EDT 2022 ======================
=====================...
0
votes
0
answers
44
views
Standard error and standard output redirection in Laravel cron job
There is a command for cron jobs in Laravel documentation:
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
Is this command the same?
* * * * * cd ...
0
votes
0
answers
33
views
Write log output only on stdout python
I have the following code:
import logging
log = logging.getLogger(__name__.replace('__',''))
log.setLevel(logging.DEBUG)
format = logging.Formatter("%(asctime)s:%(levelname)s:%(message)s")
...
1
vote
1
answer
27
views
Save ggplot to stdout
Is it possible to save a ggplot figure to stdout, preferably with ggsave? How can I do this?
I am looking to do something like:
Rscript make_fig.R > my_fig.png
2
votes
1
answer
41
views
Tailing named pipe in Docker to write to stdout
My Dockerfile:
FROM php:7.0-fpm
# Install dependencies, etc
RUN \
&& mkfifo /tmp/stdout \
&& chmod 777 /tmp/stdout
ADD docker-entrypoint.sh /usr/local/bin/docker-entrypoint....
0
votes
0
answers
25
views
tqdm status bar disappeared when using IPython display clearing
I want to output several rows of information in a cycle by printing it and simultaneously estimating elapsed time in jupyter notebook, here I tried to do so:
import time
import IPython
for i,j in ...
0
votes
0
answers
28
views
Can not see Unpacking report of Git command in C# process output
I use the Process object for executing git command (Fetch). Complete command body is "$ git fetch --progress --verbose "origin" main:remotes/origin/main"
private async Task<...
0
votes
3
answers
72
views
Update only two lines in print inside jupyter notebbok
I want to print only two lines in my cycles, I started with the following:
import time
for i in range(10):
time.sleep(0.5)
for j in range(10):
time.sleep(0.5)
print('Index1:', ...
0
votes
1
answer
39
views
How to redirect stdout and stderr to the same file
How to redirect both standard output and standard error to the same file?
so if there is a command like grep "ABC" /etc/passwd > output
this only directs the standard output to this file
...
1
vote
0
answers
19
views
How to dump png to stdout? [duplicate]
#pdf('/dev/stdout')
png('/dev/stdout')
plot(1:10, 1:10)
dev.off()
The above code works for pdf, but doesn't work for png.
$ lr -e 'source("main.R");'
Error in dev.off() :
...
0
votes
1
answer
22
views
PBS (pro) - where can I find the STDOUT and STDERR while job is running?
I submitted (qsub) a (very) long-running job to the PBS-pro scheduler. I set the paths for STDOUT and STERR using the -o and -e options, but these will only be written at the end of the run, and I'd ...
0
votes
0
answers
27
views
Can I block writing to stdout on keypress? [duplicate]
I want to create a login screen in CLI and I want to make the password prompt to detect keypresses and add the characters to a variable but not to display anything (or display asterisks instead).
I'm ...
0
votes
0
answers
22
views
Emscripten processing large stdout as ArrayBuffer
I wonder if there is a way to read large stdout output as ArrayBuffer. So far I have discovered two options:
having defined module.print(text => ...) which converts the stdout to text which I need ...
0
votes
0
answers
27
views
Can logging to syslog from inside a container be visible to host's syslog?
I have a C application that uses syslog API for logging. This application is further running inside a docker container (FROM ubuntu 20.04)
I am trying to collect the logs from container using the ...
0
votes
1
answer
56
views
sed and tee when working together in pipes no longer behaves like stream [duplicate]
Anyone can help explaining why sed and tee when used separately seems to behave like stream but not when combined?
You can see how stdout is progressively being streamed to stdout.
But when used ...
0
votes
1
answer
29
views
How can I get the stdout of each command and modify them in a linux bash script? [duplicate]
This question is kind of hard to formulate in one title.
I have a bash script that start in background 3 pythons scripts.
Each script are printing stuff on stdout. Now as they are running in parallel, ...