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

getfilesystemencoding can be None, causing error #59

Closed
wryun opened this issue Sep 25, 2019 · 5 comments
Closed

getfilesystemencoding can be None, causing error #59

wryun opened this issue Sep 25, 2019 · 5 comments

Comments

@wryun
Copy link

wryun commented Sep 25, 2019

In Python before 3.2, it's possible to get None from this. However AWS Codebuild is setting things up, this causes pathlib2 to explode:

...
  File "/codebuild/output/src991325250/src/github.com/.../ve-web/local/lib/python2.7/site-packages/pathlib2/__init__.py", line 928, in _make_child 
    drv, root, parts = self._parse_args(args) 
  File "/codebuild/output/src991325250/src/github.com/.../ve-web/local/lib/python2.7/site-packages/pathlib2/__init__.py", line 885, in _parse_args 
    parts.append(a.encode(sys.getfilesystemencoding())) 
TypeError: encode() argument 1 must be string, not None 
@mcmtroffaes
Copy link
Collaborator

Thanks for reporting. I cannot reproduce the problem but I see it's possible according to the documentation: https://docs.python.org/2/library/sys.html#sys.getfilesystemencoding

I've seen other code in the cpython implementation fall back to ascii in these cases (see for instance python/cpython@3741eff), I'll add a patch to do the same in pathlib2.

@mcmtroffaes
Copy link
Collaborator

Could you test and confirm that 59e893e fixes the issue that you reported?

@wryun
Copy link
Author

wryun commented Sep 27, 2019

Yes, this fixes the issue for me - thanks for the fast response!

@mcmtroffaes
Copy link
Collaborator

Splendid. Thanks for confirming!

@mcmtroffaes
Copy link
Collaborator

FYI I've just pushed a new release including the fix.

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