"John Eikenberry" <[EMAIL PROTECTED]> wrote:
> Ian Mallett wrote:
>
>> Hi,
>> Exactly what it sounds like. Using pygame.image.load("[file]") will
>> return
>> an error if the file doesn't exist. How do you test if it exists
>> without
>> actually loading it, and without crashing? Thanks.
>
> os.path.exists(path)
>
> http://docs.python.org/lib/module-os.path.html
Some consider it "more pythonic" to just try the call and deal with the
exception:
try:
pygame.image.load(imagefile)
except pygame.error:
# handle the error here
-Dave LeCompte