yash_g5
yash_g5

Reputation: 121

Unable to run turtle class in python

I am getting the following error:

Traceback (most recent call last):
  File "C:/Users/yashg/AppData/Local/Programs/Python/Python36-32/turtle2.py", line 1, in <module>
    import turtle
  File "C:/Users/yashg/AppData/Local/Programs/Python/Python36-32\turtle.py", line 18, in <module>
    draw_square()
  File "C:/Users/yashg/AppData/Local/Programs/Python/Python36-32\turtle.py", line 3, in draw_square
    window=turtle.Screen()
AttributeError: module 'turtle' has no attribute 'Screen'

Upvotes: 1

Views: 227

Answers (1)

falsetru
falsetru

Reputation: 369094

You should rename your script other than turtle.py. Otherwise it prevents import of standard library turtle; your module is searched first and imported instead of standard library one.

Also make sure there's no turtle.pyc remained in the directory C:\Users\yashg\AppData\Local\Programs\Python\Python36-32.

Upvotes: 1

Related Questions