0

I'm trying to learn from Think Python, and have gotten to the point where I need TurtleWorld. Swampy has been successfully imported, but but after following the steps needed, I still cannot import TurtleWorld, getting a 'ModuleNotFoundError: No module named 'Gui'' each time. If I try swampy.TurtleWorld, I get this:

>>> from swampy.TurtleWorld import*
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\resid\AppData\Local\Programs\Python\Python311\Lib\site-packages\swampy\TurtleWorld.py", line 10, in <module>
    from Gui import Callable
ModuleNotFoundError: No module named 'Gui'

And if i try simply TurtleWorld:

>>> from TurtleWorld import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'TurtleWorld'

I think I've been looking at it for too long to take a step back and figure it out, any help or advice is appreciated.

edit: I have python3.11.4 and got swampy from its source code.

Resident
  • 1
  • 2

2 Answers2

0

It looks like Gui is a module inside of TurtleWorld.py so it likely cannot be installed via a package manager directly. I created a clean python environment and was able to import the module with these steps.

conda create -n <env_name> python==3.11.4

This creates a python environment

pip install swampy
pip install tk

This installs all the dependencies I needed to import the module.

Note: from TurtleWorld import * will only work if you downloaded the source code. If you used a package manager like pip or conda it will have to be accessed via swampy.TurtleWorld.

0

I ended up deleting swampy, unzipping it and instead of putting the file in the Python lip folder, I put its entire contents into the folder.

I’m going to leave this up in case anyone in the future has a similar problem.

Resident
  • 1
  • 2