Skip to content

pygbag 0.9.2 - Local serving fails with pythonrc.py 404 and Python code not executing #94

@k3-git

Description

@k3-git

Dear pygbag Developers,

I am encountering a critical issue when trying to run a simple Pygame application (test_main.py) locally using pygbag 0.9.2 (the latest stable version available on PyPI). The application was working correctly as of August 20th, but it has stopped functioning since then without any changes to my local pygbag installation or the application code.

Environment:

OS: Windows (win32)
pygbag version: 0.9.2
Python version: (Please specify your Python version, e.g., 3.9, 3.10, 3.11, 3.12)
Virtual environment is being used.
Application Code ([test_maitest_main.py)):

import pygame
import asyncio

print("--- EXECUTING TEST_MAIN.PY ---")

async def main():
    pygame.init()
    screen = pygame.display.set_mode((640, 480))
    pygame.display.set_caption("Pygbag Structure Test")
    print("--- Pygame Initialized (Test) ---")

    running = True
    while running:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False

        screen.fill((0, 255, 0))  # Green
        pygame.display.flip()
        
        await asyncio.sleep(0)

    print("--- Exiting Test ---")

# This is the standard entry point for pygbag
asyncio.run(main())

Steps to Reproduce:

  1. Run pygbag assets\test_main.py from the project root.
    • Initially, this resulted in ERR_EMPTY_RESPONSE in the browser.
    • Terminal output showed Serving HTTP on 127.0.0.1 port 8000.
  2. Checked for port conflicts using netstat -ano | findstr :8000.
    • Found python.exe (PID 12792) listening on port 8000.
  3. Terminated the conflicting python.exe process using taskkill /PID 12792 /F.
  4. Reran pygbag assets\test_main.py.
    • The ERR_EMPTY_RESPONSE was resolved.
    • The pygbag loading screen appeared, followed by a "Ready to start" prompt.
    • Upon clicking "Ready to start", the screen turned black and remained black.

Observed Issues (from Browser Console and Terminal):

  1. pythonrc.py 404 Error:
    • Browser console showed: :8000//archives/0.9/pythonrc.py:1 Failed to load resource:
    • the server responded with a status of 404 (File not found)
    • Attempted to web_fetch https://pygame-web.github.io/archives/0.9/pythonrc.py (the CDN URL referenced in index.html), which also resulted in a 404. This indicates the file is missing from the CDN.
    • Confirmed pythonrc.py is not present in d:\babel\assets\build\web\archives\0.9\ or within the pygbag installation (d:\babel.venv\lib\site-packages\pygbag).
  2. Python Code Not Executing:
    • Even after manually creating an empty pythonrc.py file (to resolve the 404), the print statements from test_main.py (--- EXECUTING TEST_MAIN.PY ---, --- Pygame Initialized (Test) ---) did not appear in the browser console. This indicates the Python script is not being executed by the pygbag runtime.
  3. Persistent "MEDIA USER ACTION REQUIRED" Loop:
    • Despite clicking the "Ready to start" prompt, the browser console continued to show pythons.js:1368 ** MEDIA USER ACTION REQUIRED [X] ** messages, suggesting the user interaction is not being registered correctly or the application is stuck waiting for it.

Conclusion:

It appears that pygbag 0.9.2 is currently unable to run simple Pygame applications locally due to a missing pythonrc.py file from its expected CDN, and potentially other issues preventing Python code execution and user interaction handling. The fact that this was working as recently as August 20th suggests a recent change in the pygbag ecosystem (e.g., CDN content) might be the cause.

Please let me know if you require any further information or testing.

Thank you for your time and assistance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions