Skip to content
Open
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions twine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@ def get_config(path: str) -> Dict[str, RepositoryConfig]:
parser = configparser.RawConfigParser()

try:
with open(realpath) as f:
parser.read_file(f)
logger.info(f"Using configuration from {realpath}")
try:
with open(realpath) as f:
parser.read_file(f)
logger.info(f"Using configuration from {realpath}")
except UnicodeDecodeError:
with open(realpath, encoding="utf-8") as f_utf8:
parser.read_file(f_utf8)
logger.info(f"Using configuration from {realpath} (decoded with UTF-8 fallback)")
except FileNotFoundError:
# User probably set --config-file, but the file can't be read
if path != DEFAULT_CONFIG_FILE:
raise

Expand Down