max(01)* wrote:
> 
> i also used try-except for checking for invalid files.
> 
[...]
> 
> i'd like to hear your suggestions and comments for improving it.

Without actually reading your code, if I may, I would suggest using
the os module to confirm that a file exists rather than waiting for an
error to be thrown.

>>> userSuppliedPath = "/this/path/does/not/exist/"
>>> import os.path
>>> if not os.path.isfile( userSuppliedPath ):
        # this has the twofold purpose of:
        # 1) making sure the path exists, and
        # 2) making sure the path is a file
        print "Error!"

        
Error!
>>> 

-- 
Daniel Bickett
dbickett at gmail.com
http://heureusement.org/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to