OK, this does not always work as expected. I shall try to fix it. 

But more importantly: os.path.relpath is only available from python 2.6. I hope this doesn't case any problems...