Skip to content
This repository was archived by the owner on Jul 26, 2026. It is now read-only.

Pr unicode encode error - #49

Merged
Harmon758 merged 5 commits into
gitpython-developers:masterfrom
xarx00:PR-UnicodeEncodeError
Feb 18, 2020
Merged

Pr unicode encode error#49
Harmon758 merged 5 commits into
gitpython-developers:masterfrom
xarx00:PR-UnicodeEncodeError

Conversation

@xarx00

@xarx00xarx00 commented Apr 5, 2019

Copy link
Copy Markdown
Contributor

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:masterFeb 18, 2020
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Development

Successfully merging this pull request may close these issues.

3 participants

@xarx00@Harmon758@Byron