Fixing issue #248

And aligning code to pep8 plus specify at least a basic Exception for the call to ``os.makedirs``.