There was an error connecting to the server Why

I have tried everything and can’t seem to get the output to work i keep getting the error “There was an error connecting to the server” Please help.

Hi @juliandeber , welcome to the forums!
Do you have a firewall/ISP?

Not that i know of i am on att for my wifi provider

1 Like

Can you try visting replit.dev in your browser? Just to test if the domain works.

1 Like

Hey i guess my router was blocking it i went inside it and unblocked it and now the output works.
However now i have a issue that mu output screen opens then closes super fast. Any idea?
My code is very basic

From turtle import *
Forward(100)
1 Like

Add the line turtle.mainloop() as the last line of code.
Your drawing won’t close like that if you add that line.
Hope this helps!

1 Like

Hi thank you for your response,
i have used the below but for some reason the line opens up and closes very quickly still.

from turtle import *
forward(100)
turtle.mainloop()

Instead of turtle.mainloop, put turtle.done.

still having the same issue i tried it with turtle.done and turtle.done()
I appreciate your help i am new to all this, signed up for a class that uses replit.

Try using this code:

from turtle import *
forward(100)
done()
2 Likes

awesome that worked! so just to confirm i need to keep the done() at the bottom every time if i want it to stay open

1 Like

I believe mainloop() will work as well. I’ve always used it, and it works.

2 Likes

thank you Nate you were a huge help, much appreciated.

2 Likes

For future users, the reason why done() works instead of turtle.done() or turtle.mainloop() is because of the first line:

from turtle import *

With this, you are importing everything that is inside/included in turtle (such as forward, done, mainloop, etc), but not the turtle module itself. That’s why using turtle.something doesn’t work even though something works.

I personally would not recommend using star imports (from something import *), and instead importing the module or specific function/variables/etc from the module:

from turtle import * # Not recommended
from turtle import forward, mainloop # Recommended if you don't need many functions
import turtle # Then use "turtle.forward" instead of "forward"
2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.