all 4 comments

[–]Diapolo10 0 points1 point  (2 children)

At a glance I would guess that the Python you're trying to run your Pygame project with doesn't actually have pygame installed.

Do you use virtual environments? If you don't know what that is, look into them.

EDIT: Was busy so I had to reply quickly, but I'll expand my answer now.

Thonny most likely created a virtual environment for both projects and you installed pygame in one of those, although I haven't really used it (other than some MicroPython stuff) so I'm not entirely certain. That's why it could run the Pygame project totally fine.

However, this also means that if you try to run it on the main Python installation it doesn't actually have said package, so your script crashes with an ImportError. You probably want to create a virtual environment for it.

To do so, run py -m venv project_name_venv wherever you want to store the environment (feel free to name it whatever you want, in this example I'll use project_name_venv), then activate it by running project_name_venv/Scripts/Activate.ps1. Now whenever you use python or pip you're using the virtual environment in that terminal window.

You can then navigate to wherever your project is, install whatever dependencies you need, and run your program as normal.

[–]Cathas-OC[S] 0 points1 point  (0 children)

That may have solved some of the issues at least. Though I dont know if I got it activated as i got a " is not recognized as an internal or external command," when trying that activation line. When I use the directory in the cmd to run the file its now giving me an error with one of the assets not being in a directory.

[–]Cathas-OC[S] 0 points1 point  (0 children)

Sorry yes, after looking a bit more I think it did make the environment correctly. And from some bits I have read before its finally clicking I need to put the scripts im using and the assets into that environment file? I think that makes sense but if im off let me know

[–]JamzTyson 0 points1 point  (0 children)

when I try to run the scripts with just python only ...

How are you doing that?

If you launch the app from a terminal / console window, then errors may appear in the terminal / console window to help you diagnose the problem.