teacher need help!

Chris Angelico rosuav at gmail.com
Sun Oct 18 20:55:09 EDT 2015


On Mon, Oct 19, 2015 at 11:50 AM, Jason Friedman <jsf80238 at gmail.com> wrote:
>> Can I suggest you find the turtle.py module in c:\windows\system32, move it
>> to somewhere more suitable and try the code again?
>
> Or, copy it, rather than move it?
> It may be that for some students turtle.py is in a terrific place already.

If it's copied, the problem will still exist. What's happening here is:

1) A file called test3.py is being run from the user's desktop.
2) It attempts to "import turtle".
3) Python discovers a turtle.py in system32, and runs it.
4) That file also does an "import turtle", getting a reference to itself.
5) turtle.Pen() fails because there isn't one.

The problem is step 3, because Python's finding someone's demo file
instead of the stdlib module. The solution is to not have the file
c:\windows\system32\turtle.py, which means deleting it or
renaming/moving it away. Copying it won't fix anything.

ChrisA



More information about the Python-list mailing list