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

Update check_style.py #6443

Merged
merged 1 commit into from
Oct 24, 2023
Merged

Conversation

dmitrishastin
Copy link
Contributor

@dmitrishastin dmitrishastin commented Oct 22, 2023

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
Copy link

update-docs bot commented Oct 22, 2023

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

Copy link
Contributor

@benjaminum benjaminum left a comment

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
35 of 37 checks passed
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