Python Forum

Full Version: run from Python3 text editor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
i cannot run my script from Python3 text editor.

i have saved the following turtle loop2.py :

import turtle
alex = turtle.Turtle()
alex.shape("turtle")

for aColor in ["red","blue","red","blue","black"] :
    alex.color(aColor)    
    alex.forward(100)
    alex.left(72)
and python3 shells reads the following:

Error:
================ RESTART: /home/pi/Documents/turlte loop2.py ================ Traceback (most recent call last): File "/home/pi/Documents/turlte loop2.py", line 2, in <module> import turtle File "/home/pi/Documents/turtle.py", line 2, in <module> t = turtle.Turtle() AttributeError: module 'turtle' has no attribute 'Turtle' >>>
It looks you have another file in the same folder that is named turtle.py. rename it to something else because it overshadow the turtle module you want to use
thanks, buran. that worked