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

Debug output for ini file reading #15

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions migrator.py
Expand Up @@ -135,6 +135,22 @@ def migrate_directory(input_dir: Path, files: List[str], db: DigikamDb,
ini = configparser.ConfigParser(strict=False)
ini_file = input_dir / ini_file_name
try:
print(f'Here comes {ini_file} in binary:')
with open(ini_file, "rb") as f:
dd = f.read()
print(f'It is {len(dd)} bytes long')
print(dd)
print(f'That was {ini_file}.')
print('Now trying to decode it:')
ss = dd.decode('utf-8')
print(ss)
print(f'That was {ini_file} decoded.')

print(f'Here comes {ini_file} read directly as UTF-8:')
with open(ini_file, "r", encoding='utf-8') as f:
print(f.read())
print(f'That was {ini_file} as UTF-8.')

ini.read(ini_file, encoding='utf8')
except Exception as err:
raise RuntimeError(f'Failed to read ini file "{ini_file}".') from err
Expand Down