Nov-29-2023, 08:49 PM
(Oct-28-2023, 11:29 AM)neronhat Wrote:(Dec-12-2018, 07:05 AM)Aikanwha Wrote: Are you by chance using "Begin to Code with Python" by Rob Miles?I want to ask, does that mean snaps is just a library written by someone? So it cannot be imported directly like official libraries like time, random,.. ?
I had the same error up until a few minutes ago, so I thought I'd drop you an answer in case you're still having this problem or for anyone who comes across this thread.
After searching for way too long, I realized that snaps isn't something that comes with pygame or python.
- You have to go to their website at aka.ms/BeginCodePython/downloads
- Download their sample zip file, which contains the example programs from the book.
- Unzip the folder.
- Go into samples-master.
- Then "Ch 03 Python Program Structure".
- Finally there you will find the elusive snaps.py file.
copy this over to the same folder that holds the py file trying to import it, and it should work.
mine didn't work at first, until I closed the shell and relaunched it.
I hope this helps!
Hi, I'm also using this book and the answer to your question is yes according to the author :
Quote:Snaps functionschapter 3 p66
The snaps library is a Python program file held in the same folder as the example pro-
grams for each chapter. The file contains all the functions we’ll use. If you want to use
snaps in another folder, simply copy the file snaps.py into the folder.
And as Aikanwha said, to use it you need to download it and then put it in the same folder as your python file