Skip to content

[Bug] Specify utf-8 encoding in version.py#8

Merged
nashsibanda merged 1 commit intomasterfrom
nash/specify-encoding-in-version-command
Jul 24, 2024
Merged

[Bug] Specify utf-8 encoding in version.py#8
nashsibanda merged 1 commit intomasterfrom
nash/specify-encoding-in-version-command

Conversation

@nashsibanda
Copy link
Copy Markdown

@nashsibanda nashsibanda commented Jul 24, 2024

With the recent update to setuptools==70.0.0, the module can no longer be installed in certain python environments. This is due to the version.py script not providing any output (get_git_version() returns None). setuptools versions prior to setuptools==66.0.0 fell back to packaging.version.LegacyVersion, which would provide a PEP440 compliant version number if one wasn't provided. This was removed in setuptools==66.

This PR adds encoding='utf-8' to the Popen command in version.py, which puts stderr and stdout into text mode, returning a string rather than returning a bytestream when read. This prevents a TypeError being raised when .strip() is called on this output (the Exception - indeed, as with all exceptions - is silently caught by the try-except block).

Tested locally.

@nashsibanda nashsibanda changed the title Specify utf-8 encoding in Popen [Bug] Specify utf-8 encoding in version.py Jul 24, 2024
@nashsibanda nashsibanda merged commit 2bc0068 into master Jul 24, 2024
@VictorTan93 VictorTan93 deleted the nash/specify-encoding-in-version-command branch December 24, 2025 07:01
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

Successfully merging this pull request may close these issues.

3 participants