0

when I use the IDLE typing in:

import turtle
turtle.forward(100)

My program works flawlessly. However when I create a .py file and attempt to execute it, it spits out this error.

AttributeError: module 'turtle' has no attribute 'forward'

I don't understand why this does not work as it is the same code. I am using python3.7 if that makes a difference. Thanks

cdlane
  • 40,441
  • 5
  • 32
  • 81
NameIsMarcus
  • 143
  • 1
  • 1
  • 6
  • Did you name your script `turtle.py`? You shouldn't have. – Selcuk Mar 13 '20 at 01:53
  • I did originally however when I renamed the file it spat out a different error. File "drawingmeme.py", line 1, in import turtle ImportError: bad magic number in 'turtle': b'\x03\xf3\r\n' – NameIsMarcus Mar 13 '20 at 01:56
  • Delete the `turtle.pyc` file too. It is a leftover compiled module from your previous trials. – Selcuk Mar 13 '20 at 01:57

0 Answers0