python turtle on mac not working
11,433
You called your file turtle.py
, so import turtle
imports your program, not the module you want.
Rename your program and delete any turtle.py[co]
files.
Comments
-
Jack F almost 2 years
I am trying to use a python import of turtle but i get an error:
Traceback (most recent call last): File "turtle.py", line 1, in <module> import turtle File "/turtle.py", line 32, in <module> turtle.pensize(2) AttributeError: 'module' object has no attribute 'pensize'
Does the python come with turtle or i have to download it separately?
My python is 2.7.2
-
Jack F about 11 yearsI renamed the file and still get the same thing
-
DSM about 11 yearsIf by "the same thing" you mean
AttributeError: 'module' object has no attribute 'pensize'
, then you're still getting the wrong module. Typeimport imp
and thenprint imp.find_module("turtle")
to see what file it's trying to import. -
Jack F about 11 yearsi got it, i had another file called turtle.pyc and it was conflicting with the import.