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

Pr unicode encode error #49

Merged
merged 5 commits into from
Feb 18, 2020

Conversation

xarx00
Copy link
Contributor

@xarx00 xarx00 commented Apr 5, 2019

This fixes the exception

Traceback (most recent call last):
  File "c:\program files\python37\lib\site-packages\gitlab\v4\bulk.py", line 429, in clone
    git.Repo.clone_from(url, wdpath)
  File "c:\program files\python37\lib\site-packages\git\repo\base.py", line 988, in clone_from
    return cls._clone(git, url, to_path, GitCmdObjectDB, progress, **kwargs)
  File "c:\program files\python37\lib\site-packages\git\repo\base.py", line 939, in _clone
    finalize_process(proc, stderr=stderr)
  File "c:\program files\python37\lib\site-packages\git\util.py", line 333, in finalize_process
    proc.wait(**kwargs)
  File "c:\program files\python37\lib\site-packages\git\cmd.py", line 402, in wait
    stderr = force_bytes(stderr)
  File "c:\program files\python37\lib\site-packages\gitdb\utils\encoding.py", line 16, in force_bytes
    return data.encode(encoding)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 29-32: ordinal not in range(128)

in git.repo.clone_from(url, path) when path contains non-ascii characters.
The stderr string being encoded contains

Cloning into 'W:\SBER\Repozitář\test/test1'...
POST git-upload-pack (237 bytes)

Very probably, this error can occur in other situations too, hence I changed the default encoding here, into the gitdb utils.

Edit: This PR is related to gitpython-developers/GitPython#761 and #48.

@Harmon758 Harmon758 merged commit 5699c13 into gitpython-developers:master Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants