err will probably not be set if an OSError occurs.