Just define this as 

```python
dname = os.path.join(os.path.dirname(abspath), 'data')
```