Make file module work on python 2.4, fix #9080

Python 2.4 do not support "except ... as ..." construct, so
revert back to the older syntax.
Fix indentation and bug #8895
Merge pull request #9088 from mscherer/fix_8895/fix_indentation_rds

Fix indentation and bug #8895
Merge pull request #9082 from mscherer/fix9080/file_not_working_py24

Make file module work on python 2.4, fix #9080