print >> sys.stderr, "Error in atexit._run_exitfuncs:"
Why print '>>' in front of sys.stderr
?
Thanks.
Python stderr is known as a standard error stream. It is similar to stdout because it also directly prints to the console but the main difference is that it only prints error messages. After writing the above code (python print to stderr), you can observe that it print debug message using sys. stderr.
The default value of file is sys. stdout . Both stdout and stderr are just used to display text from your program in the terminal, by default. See for example Wikipedia for more details on standard streams.
Use the fprintf Function to Print to stderr in C standard input ( stdin ) - used for reading input. standard output ( stdout ) - used for writing output. standard error stream ( stderr ) - used to log error or debug messages during run-time.
This syntax means writes to a file object (sys.stderr
in this case) instead of standard output. [Link]
In Python 3.0, print
becomes a function instead of a statement: [Link]
print("Error in atexit._run_exitfuncs:", file=sys.stderr)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With