Skip to content
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

Duplicated printing of the same line #5890

Open
fraioo opened this issue Nov 29, 2020 · 1 comment
Open

Duplicated printing of the same line #5890

fraioo opened this issue Nov 29, 2020 · 1 comment

Comments

@fraioo
Copy link

fraioo commented Nov 29, 2020

The following code ran in 2 different notebooks gives two different results. One of them is duplicating the printing command as you can see (in the screenshots attached)
Captura de ecrã 2020-11-29, às 21 59 34
Captura de ecrã 2020-11-29, às 21 59 53

and the other one is perfectly fine. And yes, I've restarted the kernel and cleaned all outputs before running both. Can you help please? I've spent tons of time around this and cannot figure out what's wrong ...

def user_choice():

choice ='WRONG'
within_range = False

while choice.isdigit() == False or within_range == False:
    
    choice = input("Please enter a number (0-10): ")
    
    if choice.isdigit() == False:
        print("Sorry that is not a digit!")
        
    if choice.isdigit() == True:
        if int(choice) in range(0,11):
            within_range = True
        else:
            print("Sorry, that number is not between 0-10.")
            within_range = False

return int(choice)`
@JakkuSakura
Copy link

JakkuSakura commented Jan 31, 2025

I ran into this issue today as well. Initially I thought it's logging's issue, but with debugger it's fine. I also found that if I run the cell with breakpoints, or run it for the second time, it's not duplicating.

I assume the code reading stderr/stdout has bug in it, but I don't have time to fix it on my own

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants