Skip to content

Support directories with unicode chars #13

@canepan

Description

@canepan

Hi, I stumbled upon this issue while using duviz on my disk with an accentuated letter ("é").
The error was:

   File "/usr/local/bin/duviz.py", line 72, in from_path_size_pairs
    for path, size in pairs:
  File "/usr/local/bin/duviz.py", line 130, in pairs
    progress_report(path)
  File "/usr/local/bin/duviz.py", line 453, in progress
    write(info.ljust(terminal_width)[:terminal_width] + '\r')
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 138: ordinal not in range(128)

and according to this article it can be resolved by adding (the one which worked for me):

    os.environ["PYTHONIOENCODING"] = "utf-8"

at the beginning of main()

Nicola

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions