Closed lzhang6 closed 8 years ago
Hm, maybe PyCharm doesn't show the standard error output? By default, pyprind's objects are using stream=2
to output results to stderr (users suggested this so they can pip the "real" output by their program to other files and such.
If you set stream=1
(which is stdout), does it work?
bar = pyprind.ProgBar(n, stream=1)
for i in range(n):
time.sleep(timesleep) # your computation here
bar.update()
Hi
after setting stream to 1,It still can't work
Sincerely
Liang
On 09/06/2016 06:58 PM, Sebastian Raschka wrote:
Hm, maybe PyCharm doesn't show the standard error output? By default, pyprind's objects are using |stream=2| to output results to stderr (users suggested this so they can pip the "real" output by their program to other files and such.
If you set |stream=1| (which is stdout), does it work?
bar= pyprind.ProgBar(n,stream=1) for iin range(n): time.sleep(timesleep)# your computation here bar.update()
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rasbt/pyprind/issues/35#issuecomment-245122216, or mute the thread https://github.com/notifications/unsubscribe-auth/AKGDTa_Skhv8IEhR3yHVWQN0TtIoxtqdks5qnfAugaJpZM4J2Xcl.
Ah, you are right, for some reason, it doesn't work with stream=1
here. However, I just gave it a try setting the stream manually and it works like a charm ;)
import pyprind
import sys
import time
n = 100
bar = pyprind.ProgBar(n), stream=sys.stdout)
for i in range(n):
time.sleep(0.1)
bar.update()
Let me know if this works for you as well, and I'd be happy to add a note to the README/docs if this solves the problem.
it works for me, thanks a lot. You should add an example using while loop. tqdm doesn't support while loop
glad to heart that this solution works and adding a while-loop example is a good idea, thanks for the suggestion (just added one). Btw. do you know if tqdm work with PyCharm out of the box? Never tried this package, looks like an interesting alternative though
tqdm can display in pycharm.
but it didn't support while loop. That is why I give up tqdm to find your package. your package is better than tqdm, becasue support percentage and while loop.
Ah, I just remembered that I added an sys.stdout.isatty()
check for setting the stream, which evaluates to False
in PyCharm. Just made a little modification and it should work with PyCharm out of the box. If you like, you can upgrade to 2.9.9 via
pip install pyprind --upgrade
it's not working in pycharm python console only and in ## PyTest for pyprind 2.11.0 and pycharm 2016.3.3 and python 3.5.
i'm doing this https://github.com/rasbt/pyprind/issues/35#issuecomment-245158319
Hi,
hm that's weird, just tested in on PyCharm with and without sys.stdout as stream and it seems to work fine in both cases. Can you maybe check via print(pyprind.__version__)
that this is indeed pyprind 2.11? Another explanation would be that there might have been some weirdness in PyCharm 2016 regarding standard outputs? ( was running this on the latest version, 2017.1.2)
The behavior depends on PyCharm's option "Show command line afterwards". If it is on, PyCharm invokes IPython console, you will see each update on the separate line. If it is off, the behavior as expected.
Thanks for the note. So it seems that it's not a bug after all !? :)
When I use terminal to run the code, the progress bar is ok while using pycharm, the progressbar can't show in result.