By default, a python game (.py) cannot be run as an HTML game.
What you should do is use the "pygbag" package to export your game to HTML format (I don't remember if it is mandatory to also use pygame).
If you've never used pygbag before, it's best to look up tutorials, since you need the main function to be asynchronous.