Getting a game written in Pygame to become a website

I have written the code for a card game using Python. I want to have a hosting site host my game so anyone can play it. However, I cannot figure out how to transform it into a website. I have tried deploying it using Netlify and itch.io, and both platforms were unable to get it to work. I even tried using ai to assist me, and when looking at the DevTools Console, here’s what the robot told me: “The 68 errors in pythons.js indicate that the PyGame WebAssembly runtime itself is failing to initialize properly.”

I am looking for assistance in getting my game to become a website. Since it works on my device, I believe this is possible. Can anyone assist me in getting my PyGame WebAssembly runtime to initialize properly?

Thank you!

I’m not able to help directly but if your explanation was clear on the approach you’re trying rather than making the reader infer details then someone who knows about this may be motivated to help.

“I have tried deploying it using both:

1.Netlify, using feature X

2. itch.io, using feature Y

Documentation XXX suggests feature X should work for task A and I’ve done:

[high level steps so someone reading this - who wasn’t sat next to you watching - has a rough idea of what you tried].”

Skip the random AI feedback until you’ve given better context.

>> Since it works on my device, I believe this is possible.

Which device? how are you running it there? What about you running it on your device makes you think it can work as a website?


Best of luck!

1 Like

I would start by following PygBag’s guidance to get a simple example running in browser. pygame-web.github.io | pygame wasm,

Then refactor the existing game’s Python code to that paradigm.

1 Like

Thank you! I will try following PygBag’s guidance to get a simple example running in my browser. I am currently using Chrome on my MacBook. Is that recommended? Would I have a better chance of success using Safari?

Thanks again!

I have no experience with Safari, but Chrome (like Firefox) tends to have the latest browser API features, and WASM apps definitely run in it. I’d stick with that.

Could you point us to your Python source code? What exactly are you using to convert it to JavaScript?

Hello again! As it turns out, your suggestion worked! After some unfruitful trials, I was able to turn my game into a website using pygbag on itch.io. Thank you so much for your suggestion!

1 Like

Brilliant - well done! Thanks for letting us know.