Posts Tagged ‘usability’

The importance of a good error message

Monday, January 26th, 2009

Two of us just spent half an hour debugging a setuptools/nose problem.  The error message we got was “IOError: [Errno 21] Is a directory”, deep from the bowels of nose.  The problem turned out to be that the current directory was named “rsrc.py”.

I understand why nose choked on “rsrc.py” — it does a lot of magic with file extensions, so it needs to know which python files have tests it can run.  However, it took us twenty-nine minutes to determine that the unacceptable directory in question was actually the parent directory.  (Do you ever expect programs to complain that the current working directory is a directory?)  Ideally, nose would have told us a) what the directory was and b) why it was so surprising that this filepath described a directory, in addition to what it did tell us, which was that it didn’t want a directory.  Something like “TestFindingError: ‘/Users/k/code/resourceful/rsrc.py’ is a directory; expected it to be a source file.” would have made it much easier to correct our original error.