[#2148] Raise OSError with consistent code for file and folder operations.

Problem
----------

Errors raised when trying to perform a folder specific or file specific action on  a non folder of non file return different errors in Windows and Unix.

The point of compat is to provide the same behavior on all systems.


Changes
----------

Update error handling on Windows, Linux and AIX to have same errors and error codes.

Python OSError and IOError are not reliable as on Linux are utf-8 and on Windows are unicode.

Things should be better in Pyhton3 ... but we still have windows errors and pywintypes... so we should have all API only raise an unified OSError

In Python 3.3: EnvironmentError, IOError, WindowsError, VMSError, socket.error, select.error and mmap.error have been merged into OSError.


How to test
------------

reviewers: @alibotean 

check that changes make sense.

Thanks!