-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lines joined when running pyprind alongside the logging module #33
Comments
Sorry for the late response @fat-lobyte, somehow, I missed the notification about this issue! One way to solve the problem is to add a newline character at the beginning of the logging string. E.g., E.g., import time
import pyprind
import logging
logging.basicConfig(format='\n%(message)s', level=logging.INFO)
n = 15
bar = pyprind.ProgPercent(n, stream=1)
for i in range(n):
time.sleep(1)
bar.update()
logging.info("Something happened.") Which then produces the following:
Hope this is what you were looking for? |
Thanks for the reply. That's not exactly what I was looking for, the problem is that outside the loop, all messages will have extra newlines. Also, the progress bar can be turned off and the output looks ugly then. Do I infer correctly that there's not a way inside pyprind to fix this? |
Oh okay. Hm, I am not sure if there's a good way to avoid that; I think it's more like a limitation of the shell environment. The only way I could think of would be to print "PyPrind" to stdout and forward the logging to a log file. E.g., Initializing the bar as
(note the Then in the shell, running it via:
The accompanying logfile will look like this then:
|
Hi!
I was trying to run both pyprind and the builtin python module
logging
at the same time. This, however did not handle particularly well:The output looks like this:
As you see, the lines from pyprind and logging are joined. This is somewhat random in a real world scenario, but happens most of the time.
I have not yet found any fix or workaround. Any ideas?
The text was updated successfully, but these errors were encountered: