Dear Martin,
You could try to reference the magic variable __file__, like this:
import os
here = os.path.dirname(__file__)
if not here:
here = '.'
print here
Python is notoriously inconsistent in providing __file__ so YMMV.
With kind regards,
Bert Driehuis