-2

I am having trouble with the turtle module.

When I use this in a file:

import turtle
t = turtle.Pen

It makes this error:

Traceback (most recent call last):
  File "C:/Users/admin/SkyDrive/Documents/turtle command game", line 1, in <module>
    import turtle
  File "C:/Users/admin/SkyDrive/Documents\turtle.py", line 8, in <module>
    p = turtle.pen()
AttributeError: 'module' object has no attribute 'pen'

but when I do the same thing in the python shell, it works fine. I copied and pasted them and made sure that they were the same.

I also tried:

from turtle import *
t = Pen()

but it returned the same error, and when I did that in the shell, everything ran smoothly.

I even tried importing the Pen() function directly in a file:

from turtle import Pen
t = Pen()

but it had the same error, but when I did it in the shell, it worked.

I have python 2.7.7 and windows 8.1

Can anyone tell me what is going on here?

Any help would be appreciated.

Pyraminx
  • 259
  • 3
  • 10

1 Answers1

6

Maybe you call your file turtle.py and now Python can't find oryginal turtle file in library.

furas
  • 134,197
  • 12
  • 106
  • 148