Skip to content

Update check_style.py - #6443

Merged
ssheorey merged 1 commit into
isl-org:masterfrom
dmitrishastin:fix-check_style
Oct 24, 2023
Merged

ssheorey merged 1 commit into
isl-org:masterfrom
dmitrishastin:fix-check_style

Conversation

@dmitrishastin

@dmitrishastin dmitrishastin commented Oct 22, 2023 •

Copy link
Copy Markdown
Contributor

Fixes the encoding error (on Windows). Complimentary to #1935

Type

  • Bug fix (non-breaking change which fixes an issue): Fixes building docs UnicodeDecodeError #1933
  • New feature (non-breaking change which adds functionality). Resolves #
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) Resolves #

Motivation and Context

Upon running python .\util\check_style.py --apply on Windows get error:

Applying C++/CUDA style (8 processes)
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "C:\anaconda3\lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "C:\anaconda3\lib\multiprocessing\pool.py", line 48, in mapstar
    return list(map(*args))
  File "C:\Open3d\util\check_style.py", line 82, in _check_style
    is_valid_header = f.read().startswith(CppFormatter.standard_header)
  File "C:\anaconda3\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 9393: character maps to <undefined>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Open3d\util\check_style.py", line 447, in <module>
    main()
  File "C:\Open3d\util\check_style.py", line 409, in main
    changed_files_cpp, wrong_header_files_cpp = cpp_formatter.run(
  File "C:\Open3d\util\check_style.py", line 118, in run
    is_valid_files = pool.map(
  File "C:\anaconda3\lib\multiprocessing\pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "C:\anaconda3\lib\multiprocessing\pool.py", line 771, in get
    raise self._value
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 9393: character maps to <undefined>

Which is fixed by adding encoding='utf-8' to open() in check_style as per stackoverflow

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description


This change is Reviewable

@update-docs

update-docs Bot commented Oct 22, 2023

Copy link
Copy Markdown

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

@ssheorey
ssheorey requested a review from benjaminum October 24, 2023 16:12

@benjaminum benjaminum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: 0 of 1 files reviewed, all discussions resolved

@ssheorey
ssheorey merged commit fa1a16c into isl-org:master Oct 24, 2023
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.

building docs UnicodeDecodeError

3 participants