```
outdir = os.path.dirname(os.path.abspath(filename))
```