Remove unused variable
Remove unused imports
Fix exception handling
The open_datafile does not return anything so do not store the return value
Merge pull request #24 from nijel/code-cleanup

Code cleanup