fix empty basedir problem in Windows

in the manual, basedir in ``basedir = os.path.dirname(__file__)`` will return an empty string in Windows.

it should use a cross-platform method: ``os.path.dirname(os.path.abspath(__file__))``

see http://stackoverflow.com/a/7783326

i tested it on windows xp with python 2.7