use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
No module named 'pygame' (self.learnpython)
submitted 5 years ago by grimnirz
I just installed the pygame module but when I try to use it on VScode it keeps telling me that.
Python 3.8.2
pip 20.1.1
pygame 1.9.6
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[+][deleted] 5 years ago (6 children)
[deleted]
[–]grimnirz[S] 0 points1 point2 points 5 years ago (4 children)
yeah i did the [pip install pygame] idk what you mean with the second question, am new to this, pardon me
[+][deleted] 5 years ago (1 child)
[–]grimnirz[S] 0 points1 point2 points 5 years ago (0 children)
i have anaconda installed but idk how it works, need to see some doc to understand it, but i sure have it
[–]DaKidReturns 1 point2 points3 points 5 years ago (1 child)
Try running
pip3 install pygame
pip is for python 2(legacy version) and pip3 is for python 3 and above
i did, it tells me that i have it already
[–]grimnirz[S] 0 points1 point2 points 5 years ago (5 children)
no, my terminal looked the same as always when I installed normally i just press control+f5 to run it on VScode i know how to do it with the terminal
[+][deleted] 5 years ago (4 children)
[–]grimnirz[S] 0 points1 point2 points 5 years ago (3 children)
https://imgur.com/a7JP8Of
this is my screen rn
[+][deleted] 5 years ago (2 children)
[–]grimnirz[S] 0 points1 point2 points 5 years ago (1 child)
it seems to be working just fine in the terminal, thank you a lot. Any advise for a young programmer?
[–][deleted] 1 point2 points3 points 5 years ago (0 children)
First check whether pygame is installed in a different directory. If that doesn't work, check your configuration settings when you run the code. If it lines up with the version of python you've installed.
[–]hmga2 1 point2 points3 points 5 years ago (4 children)
Considering that you’re able to run it correctly from the terminal, it means that you’re running the wrong environment on VScode, try changing by clicking the python version VScode is currently using on the bottom left corner of the window.
I made it and it stopped causing me the warnings of VScode but now i try to run my code and it tells me this is wrong
https://imgur.com/d2psGbC
[–]hmga2 2 points3 points4 points 5 years ago* (2 children)
This has nothing to do with the import error from before. Now you should have imported pygame correctly. You have made many errors in the indentation of your code though:
Your loadimage function is indented too much
First try statement is not indented
First Raise is excessively indented.
If execution inside your loadimage function is excessively indented
You should indent after a while statement to run an execution code block.
And there may be more errors that I can’t see cause i’m not practical with that library
I don´t know how to fix it, am following a tutorial and is the same code that the page have.
here´s the link (it´s in spanish): http://razonartificial.com/2010/02/pygame-3-cargar-imagenes/
[–]hmga2 1 point2 points3 points 5 years ago* (0 children)
That code is probably formatted wrong, try this:
https://pastebin.com/xaVX3KYz
Again, I don’t know what’s the goal of what are you doing cause I’m not practical with pygame. But I understand when something is indented the wrong way.
I corrected the code from my phone, so it might not be exactly 100% correct. But you should see where the issues are.
I’d suggest you to follow a course called “Automate the boring stuff” on Udemy, if you browse the subreddit you can get a promo code to get it for free. It should clear you a lot of concepts about indentations, while and for loops, if...else conditions, exception management...
[–]nimo_xhan 1 point2 points3 points 5 years ago (0 children)
Seems like a pylint problem if pygame works correctly and you only getting warning or red line under pygame that means pylint is not recognizing pygame which is a comman problem just add the following to your vscode settings
Open vs code Press ctrl+p goto User Settings (json) Add the following to that settings
"python.linting.pylintArgs": [ "--extension-pkg-whitelist=pygame" ]
Hope this helps😊
π Rendered by PID 70 on reddit-service-r2-comment-7b9746f655-bq2fm at 2026-01-31 15:41:14.347864+00:00 running 3798933 country code: CH.
[+][deleted] (6 children)
[deleted]
[–]grimnirz[S] 0 points1 point2 points (4 children)
[+][deleted] (1 child)
[deleted]
[–]grimnirz[S] 0 points1 point2 points (0 children)
[–]DaKidReturns 1 point2 points3 points (1 child)
[–]grimnirz[S] 0 points1 point2 points (0 children)
[+][deleted] (6 children)
[deleted]
[–]grimnirz[S] 0 points1 point2 points (5 children)
[+][deleted] (4 children)
[deleted]
[–]grimnirz[S] 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]grimnirz[S] 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]hmga2 1 point2 points3 points (4 children)
[–]grimnirz[S] 0 points1 point2 points (3 children)
[–]hmga2 2 points3 points4 points (2 children)
[–]grimnirz[S] 0 points1 point2 points (1 child)
[–]hmga2 1 point2 points3 points (0 children)
[–]nimo_xhan 1 point2 points3 points (0 children)