Running Script

Fairly new to both ATOM and Python.

I am currently in the middle of an online Python course. At present we are doing Turtle Graphics.
When I log onto Python 3.7 direct, my commands work.

  1. import turtle
  2. wn=turtle.Screen()
  3. alex=turtle.Turtle()

When I try and run the script on ATOM, i get the following error.

Traceback (most recent call last): File “C:\Coding\turtle.py”, line 1, in import turtle
File “C:\Coding\turtle.py”, line 2, in ; wn=turtle.Screen() AttributeError: module ‘turtle’ has no attribute ‘Screen’

[Finished in 0.053s]

Most likely a noob mistake but it’s frustrating.

I have installed both a script package and a terminal package.

Can someone point me in the right direction. Please.

The mistake is that you named your file turtle.py, which is the same name as the module you’re trying to import. When importing modules, Python looks first in the folder that contains the running script, so it finds your turtle.py and stops looking.

Thanks a million.

How blind of me. Many moons ago (80’s) I played with ‘basic’ and ‘machine’ code. One thing that never changes is naming conventions.

I spoke too soon. I have changed the name to I get the following listed under problems.

Module ‘turtle’ has no ‘Screen’ member pylint(no-member) [2, 6]
Module ‘turtle’ has no ‘Turtle’ member pylint(no-member) [3, 8]

I have tried reading everywhere. When I load the module ‘turtle’ straight into the python 3.7 IDE, it will load my program lines with no errors. There must be a problem with Atom.

Why would there be a problem with Atom when Atom has no ability to run code? There may be a problem with a package, and each of those is a separate troubleshooting issue. What happens when you try to run the file with the python command using a terminal package such as termination?

This seems to be a common issue with pylint. The real question is whether the script runs.

One thousand apologies. In my stupidity I was trying to find any compiler to work. I had both ATOM and Vis Studio Code open. That is where the pylint problem came from.

I uninstalled Vis Studio, changed the program name, added both ‘platformio-ide-terminal’ and ‘script’ to my packages and everything is working fine.

thanks again mate. I learned a lesson today.

1 Like

thanks a ton… I came across the same issue… repeated exactly same mistake.