[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Testing if a File Exists



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

-- 

John Eikenberry
[jae@xxxxxxxx - http://zhar.net]
______________________________________________________________
"It is difficult to produce a television documentary that is both incisive
and probing when every twelve minutes one is interrupted by twelve dancing
rabbits singing about toilet paper." - Rod Serling