rsalmei / alive-progress

A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
MIT License
5.53k stars 206 forks source link

IDLE breaks stdout #109

Closed borderline23 closed 3 years ago

borderline23 commented 3 years ago

from alive_progress import alive_bar

with alive_bar(1000) as bar: for i in compute(): bar()

////////////////////////////////////////////////////////////

Traceback (most recent call last): File "C:\Users\erman\Desktop\prova.py", line 1, in from alive_progress import alive_bar File "C:\Users\erman\AppData\Local\Programs\Python\Python39\lib\site-packages\alive_progress__init.py", line 2, in from .core.progress import alive_bar, alive_it File "C:\Users\erman\AppData\Local\Programs\Python\Python39\lib\site-packages\alive_progress\core\progress.py", line 10, in from ..utils.cells import combine_cells, fix_cells, print_cells, to_cells File "C:\Users\erman\AppData\Local\Programs\Python\Python39\lib\site-packages\alive_progress\utils\cells.py", line 63, in def print_cells(fragments, cols, last_line_len=0, _write=sys.stdout__.write): # noqa AttributeError: 'NoneType' object has no attribute 'write'

TheTechRobo commented 3 years ago

Why in the Lord's name is sys.stdout None?

borderline23 commented 3 years ago

Why in the Lord's name is sys.stdout None?

i don't know i just use: pip install alive-progress

and try the code in a new .py file

rsalmei commented 3 years ago

Why in the Lord's name is sys.stdout None?

Yeah, he is right! WHY? The imports were just starting to execute, and the default param I've set for _write can't resolve sys.stdout.write?? That doesn't make any sense. Please give me more info:

borderline23 commented 3 years ago

sorry man i m not a professional coder.. i just installed alive-progress with pip and put the example code in new .py so the code is:

from alive_progress import alive_bar

with alive_bar(1000) as bar: for i in compute(): bar()

python version 3.9 64bit i run that code from IDLE - RUN - RUN MODULE

Why in the Lord's name is sys.stdout None?

Yeah, he is right! WHY? The imports were just starting to execute, and the default param I've set for _write can't resolve sys.stdout.write?? That doesn't make any sense. Please give me more info:

* What python are you using?

* What is the exact program you tried to run?

* How did you call it?

* Where did you call it, shell or ipython?

sorry man i m not a professional coder.. i just installed alive-progress with pip and put the example code in new .py so the code is:

from alive_progress import alive_bar

with alive_bar(1000) as bar: for i in compute(): bar()

python version 3.9 64bit i run that code from IDLE - RUN - RUN MODULE

rsalmei commented 3 years ago

Ahhh I see, it's that IDLE thing... It is not a Python environment, it is a program running on top of it... Unfortunately, programs can do whatever they want, and IDLE in particular is known to break stuff.

Anyway, you can run your prog.py directly in the shell:

> python prog.py

And to experiment and explore python, i strongly recommend ipython, it's awesome! Just:

> pip install ipython

And then start it: ipython. In there you can write and test code at the same time, and reuse past inputs and outputs.

rsalmei commented 3 years ago

OK, I'm closing this one, as it's not a problem.

TheTechRobo commented 3 years ago

@rsalmei Offtopic but I'm curious: Have you ever tried https://github.com/bpython/bpython? It looks pretty cool, but I haven't tried it myself

rsalmei commented 3 years ago

Hey @TheTechRobo, YES! It was once my favorite Python REPL, but unfortunately it wasn't working anymore last time I've checked... I don't recall exactly what was the problem, it was long ago, ~3 years, but I had to switch to ipython, and started recommending it instead. But do try it! And let me know if it is working nowadays... 👍

TheTechRobo commented 3 years ago

@rsalmei Seems to work fine for me!

image

rsalmei commented 3 years ago

Cool! It is awesome to discover new frameworks, with that auto-docstrings panel! 👍