1. pygame
  2. pygame
  3. pygame

Issues

Issue #138 invalid

Problem launching a pygame

Charlie Capgras
created an issue

I get a problem launching Dodge Cars pygame available at this adress: http://www.pygame.org/project-Dodge+Cars+by+Suhas-2419-.html

I tried to debug the source code with pdb but i am not succeeding to solve the problem.

Here is the localization of the problem :

bg = pygame.image.load("res/bg.png") pygame.error: Couldn't open res/bg.png Exception AttributeError: "'NoneType' object has no attribute 'path'" in <function _remove at 0x014822B0> ignored

Comments (2)

  1. Sam Bull

    The code is working. How are you running the game? It needs to find the images in the res folder, which must be in your current working directory. The error you see is because it is failing to open the requested file.

    If you try running it by double-clicking or similar, it may not consider the working directory to be the directory that the file is being run from.

    On Linux/Mac you can use a terminal and run:

    cd path/to/jargnar-DodgeCars-7f02593/
    python dodgecars.py
    

    Obviously, changing the path to wherever you've saved the folder.

  2. Charlie Capgras reporter

    You are right. Using a relative path makes it works. Thanks you for your help.

    I get another question. Python debugger pdb is lacking a capacity of browsing easily the source code (for example to place some breakpoints). So I've downloaded a Python IDE (Wingware) to try it. Debugging is more effective, but the graphic windows is crashing when I'm stepping into classes. Does some others Python IDE have better abilities ?

  3. Log in to comment