Fix Python 3 compatibility

In Python 3, `pathname2url` accepts `str` (which is aliased as `unicode` in `compat.py`), so `path` should not be encoded.