Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fpath.Dir.walk() can raise UnicodeDecodeError #5

Open
remram44 opened this issue Jun 5, 2014 · 1 comment
Open

fpath.Dir.walk() can raise UnicodeDecodeError #5

remram44 opened this issue Jun 5, 2014 · 1 comment

Comments

@remram44
Copy link

remram44 commented Jun 5, 2014

On Linux with Python 2:

$ echo -e 'r\xE9mi' | xargs touch
$ python
Python 2.7.7rc1 (default, May 21 2014, 12:59:42)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import fpath
>>> list(fpath.Dir('.').walk())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/venv/local/lib/python2.7/site-packages/fpath.py", line 699, in walk
    s = child.stat(usecache=True, followlinks=not links)
  File "/tmp/venv/local/lib/python2.7/site-packages/fpath.py", line 516, in stat
    return Stats(self, usecache, followlinks)
  File "/tmp/venv/local/lib/python2.7/site-packages/fpath.py", line 53, in __init__
    self._stat()
  File "/tmp/venv/local/lib/python2.7/site-packages/fpath.py", line 60, in _stat
    self._cached = os.stat(unicode(self._path))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 1: ordinal not in range(128)

I know you're not the only project out there that gets it wrong, but in my quest for something sensible I did test yours, so I thought I'd let you know. My search goes on!

@wackywendell
Copy link
Owner

Hi,

Thanks for looking into it, and filing a bug report. I've lost most of my interest in this now that I'm working almost entirely in Python 3 and pathlib exists, but pull requests are welcome!

@remram44 remram44 changed the title fpath.Dir.walk() can't raise UnicodeDecodeError fpath.Dir.walk() can raise UnicodeDecodeError Jun 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants