Python Forum
python turtle module in pycharm error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python turtle module in pycharm error
#1
hi guys  

import turtle def draw_star(size,color):     count = 0     angle = 144     sum1 = 0    # turtle.bgcolor='black'     turtle.bgcolor = 'black'     turtle.pen='yellow'     while count <= 5:         for i in (1,5):             sum1=sum1+45             if count<5:                 turtle.forward(sum1)                 turtle.right(angle)             if count>5:                 turtle.forward (-size)                 turtle.right (angle)         count += 1     return draw_star(200,"blue")
This code run in python idle without error. but pycharms cant run this code  Think    

pycharm error:

Traceback (most recent call last):
  File "C:/Users/3DVFX/PycharmProjects/untitled4/turtle.py", line 1, in <module>
    import turtle
  File "C:\Users\3DVFX\PycharmProjects\untitled4\turtle.py", line 21, in <module>
    draw_star(200,"blue")
  File "C:\Users\3DVFX\PycharmProjects\untitled4\turtle.py", line 13, in draw_star
    turtle.forward(sum1)
AttributeError: module 'turtle' has no attribute 'forward'
Reply
#2
Rename turtle.py.
Name is used in bye python to run the module eg ‪C:\Python35\Lib\turtle.py
Reply
#3
(Dec-12-2016, 08:14 PM)snippsat Wrote: Rename turtle.py.
Name is used in bye python to run the module eg ‪C:\Python35\Lib\turtle.py

i rename turtle.py to myturtle.py    Tongue Clap

Thankyou
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error in Pycharm Hudjefa 3 2,223 Oct-09-2024, 08:41 PM
Last Post: deanhystad
  Pandas - error when running Pycharm, but works on cmd line zxcv101 2 3,506 Sep-09-2024, 08:03 AM
Last Post: pinkang
  updating pip, python - understanding terminal and pycharm. endlessnameless 0 2,251 Jun-24-2024, 05:48 AM
Last Post: endlessnameless
  Pycharm error zuri 1 1,476 Nov-01-2023, 03:38 PM
Last Post: deanhystad
  Newbie question about switching between files - Python/Pycharm Busby222 3 2,055 Oct-15-2023, 03:16 PM
Last Post: deanhystad
  Can't update new python version on Pycharm GOKUUUU 6 10,236 Jul-23-2022, 09:24 PM
Last Post: GOKUUUU
  No module named '_cffi_backend' error with executable not with python script stephanh 2 9,480 Nov-25-2021, 06:52 AM
Last Post: stephanh
  How to use GPU in Python or Pycharm? plumberpy 2 21,166 Oct-11-2021, 12:57 PM
Last Post: plumberpy
  Cannot install tensorflow, numpy etc in Pycharm with Python 3.10 plumberpy 2 5,466 Oct-07-2021, 05:33 AM
Last Post: plumberpy
  PyCharm Error? coder_sw99 4 3,501 Sep-24-2021, 06:16 PM
Last Post: Yoriz

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.