Trouble with turtles

11 Feb, 2018

Theodore M writes:

Hello. Working in python with my daughter, but stuck on this error:

Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> import turtle
Traceback (most recent call last):
File "", line 1, in
import turtle
File "/Users/mac/Documents/turtle.py", line 2, in
t=turtle.Pen()
AttributeError: module 'turtle' has no attribute 'Pen'

It looks as if you might have created a file called turtle.py in your Documents directory (/Users/mac/Documents), and because you're running IDLE from the same directory (I assume), that file is being loaded before the actual turtle module. If you delete this file and try again, hopefully you'll have more success.