Python Forum
run from Python3 text editor
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
run from Python3 text editor
#1
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' >>>
Reply
#2
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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
thanks, buran. that worked
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  while loop not working-I am using sublime text editor mma_python 4 1,141 Feb-05-2023, 06:26 PM
Last Post: deanhystad
  Sublime Text Editor not recognizing Python elroberto 5 2,883 Jun-13-2022, 04:00 PM
Last Post: rob101
  Music Notation editor; how to build the editor? direction to go? philipbergwerf 1 1,695 Jan-01-2022, 04:56 PM
Last Post: Larz60+
  Gnuradio python3 is not compatible python3 xmlrpc library How Can I Fix İt ? muratoznnnn 3 4,915 Nov-07-2019, 05:47 PM
Last Post: DeaD_EyE
  Running python from Sublime Text editor balley810 2 3,016 Jul-14-2019, 03:40 PM
Last Post: ThomasL
  How to display what I write on sublime text editor on the CMD el_bueno 5 3,235 Feb-04-2019, 02:00 PM
Last Post: buran
  I can't locate Python Text Editor Rahulsunv 2 3,582 May-16-2017, 05:34 AM
Last Post: Larz60+
  getting current filename of a text editor file for printing file name? hsunteik 3 5,047 Dec-24-2016, 07:58 PM
Last Post: Blue Dog

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020