Python Forum
TurtleWorld on MAC in Python 3.6 issues
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TurtleWorld on MAC in Python 3.6 issues
#1
I have an issue getting TurtleWorld to work for my book "ThinkPython" for version 3.6. I cannot get it to work in pycharm or on my terminal CLI. These are my errors:

cha-105889-l:swampy-2.1.7 username$ pip3 install swampy
Requirement already satisfied: swampy in /usr/local/lib/python3.6/site-packages (2.1.7)

cha-105889-l:swampy-2.1.7 username$ python3
Python 3.6.4 (default, Mar 22 2018, 14:05:57)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> import tkinter
>>> import swampy.TurtleWorld
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/blamb/Downloads/swampy-2.1.7/swampy/TurtleWorld.py", line 8, in <module>
from Tkinter import TOP, BOTTOM, LEFT, RIGHT, END, LAST, NONE, SUNKEN
ModuleNotFoundError: No module named 'Tkinter'
>>>
>>>
>>> import swampy
>>>
>>>
>>> from TurtleWorld import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'TurtleWorld'
>>>
>>>

This is the code from pycharm:

/Users/blamb/PycharmProjects/ThinkPython/venv/bin/python /Users/blamb/PycharmProjects/ThinkPython/Turtle.py
Traceback (most recent call last):
File "/Users/blamb/PycharmProjects/ThinkPython/Turtle.py", line 1, in <module>
from TurtleWorld import *
ModuleNotFoundError: No module named 'TurtleWorld'

Process finished with exit code 1
Reply
#2
The package you're loading is for Python 2.7 and you are running it in 3.6. The name of the package changed from Tkinter to tkinter in 3.x.

You either need to run it in 2.7 or get an updated version of it.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
I may have both being used, but can successfully run the following from the newer tkinter version from my 3.6 python version:

import tkinter

tkinter._test()


I cannot run the rest of the code though. This is the code and the error:

import tkinter

tkinter._test()

from TurtleWorld import *

world = TurtleWorld()
bob = Turtle()

def square(t):
    for i in range(4):
        fd(t, 100)
        lt(t)

square(bob)
wait_for_user()
Error:
/Users/username/PycharmProjects/ThinkPython/venv/bin/python /Users/username/PycharmProjects/ThinkPython/Turtle.py Traceback (most recent call last): File "/Users/username/PycharmProjects/ThinkPython/Turtle.py", line 5, in <module> from TurtleWorld import * ModuleNotFoundError: No module named 'TurtleWorld' Process finished with exit code 1
Just before my above error, the tkinter screen did pop up as before, but the TurtleWorld is where it failed. I will try installing it again for the 4th time

The above was from pycharm, this below is from the Terminal:

>>> import _tkinter
>>> import tkinter
>>> import swampy.TurtleWorld
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/swampy/TurtleWorld.py", line 8, in <module>
    from Tkinter import TOP, BOTTOM, LEFT, RIGHT, END, LAST, NONE, SUNKEN
ModuleNotFoundError: No module named 'Tkinter'
The above shows the newer version of tkinter being imported, but the TurtleWorld error points to the older version for python 2.7 with the uppercase "T".
Reply
#4
It's the same error in a different place. All of the Tkinter imports need to match, and you need to use the appropriate version of Python for the import you have.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Shocked Issues Installing Pyenv/Python 3.9.1 Brandon_Contactum 1 2,540 Feb-22-2022, 06:32 PM
Last Post: snippsat
  Issues with Python script as service satishgunjal 8 7,497 Jun-21-2018, 11:40 AM
Last Post: satishgunjal
  python variable issues - using spyder and opencv Afrodizzyjack 5 5,808 Jun-19-2018, 09:46 AM
Last Post: gontajones
  issues while using Psexec from python code dev_devil_1983 0 3,536 May-28-2018, 07:55 AM
Last Post: dev_devil_1983
  TurtleWorld module not found sangurocactus 1 3,314 May-26-2018, 02:26 PM
Last Post: ljmetzger
  Python random formatting issues Barnettch3 10 5,964 Jan-28-2018, 11:04 PM
Last Post: Gribouillis
  Python and Pika stability issues tremmert 0 47,228 Jun-06-2017, 11:46 AM
Last Post: tremmert
  Issues with running regedit command from python gohanzdad 10 9,926 May-16-2017, 04:28 PM
Last Post: gohanzdad

Forum Jump:

User Panel Messages

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