thonny / thonny

Python IDE for beginners
https://thonny.org
MIT License
2.97k stars 993 forks source link

import livewires Traceback error #3008

Open Raspberry45man opened 7 months ago

Raspberry45man commented 7 months ago

Using book "Python Programming for Absolute Beginner:, in Chapter 11 loaded source code program with filename "new_graphics_window.py". Get Traceback error as follows:

Traceback (most recent call last):
  File "F:\Compilers S-Visual\Thony (Python)\Projects\Working\Python Programming for the Absolute Beginner_2ED\chapter11\new_graphics_window.py", line 9, in <module>
    from livewires import games
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\livewires\__init__.py", line 32, in <module>
    from beginners import *
ModuleNotFoundError: No module named 'beginners'

In my python build on win11 home version, running python 3.12, I have in Lib folder under site-packages, I have two folders named 'livewires' and 'LiveWires-2.1.dist-info'. An in the livewires folder there are the following three files.. init.py; and beginners.py; and games.py. Therefore, I do not understand why I am getting this Traceback error report. There is a module (script) name beginners.py.

Note also, my python version is loaded and its path is.. "C:\Users\xxxxx\AppData\Local\Programs\Python\Python312\python.exe"; which is also where the 'Lib' folder is located.

Here is a copy of the new_graphics_window.py file source code.. and the line 'from livewires import games, is the source of the traceback error catch..

# New Graphics Window
# Demonstrates creating a graphics window
#
from livewires import games
games.init(screen_width = 640, screen_height = 480, fps = 50)
games.screen.mainloop()

What is wrong?

aivarannamaa commented 7 months ago

in the livewires folder there are the following three files.. __init__.py; and beginners.py; and games.py.

In such setup, the correct way to import beginners.py is from livewires import beginners.