Open Bug 1945635 Opened 4 days ago Updated 4 days ago

./mach doc running into UnicodeDecodeError: 'ascii' codec can't decode byte

Categories

(Developer Infrastructure :: Source Documentation, defect)

defect

Tracking

(Not tracked)

People

(Reporter: olivia, Unassigned)

Details

When running ./mach doc with a mozconfig setup for Desktop on an M2 Mac, I run into:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 7739: ordinal not in range(128)

  File "/Users/olivia/Repos/gecko/tools/moztreedocs/mach_commands.py", line 184, in build_docs
    status, warnings = _run_sphinx(docdir, savedir, fmt=fmt, jobs=jobs, verbose=verbose)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/olivia/Repos/gecko/tools/moztreedocs/mach_commands.py", line 315, in _run_sphinx
    warnings = warn_file.readlines()
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

When my mozconfig is setup for Android I run into the same error (but it is also presented differently):

Exception in callback <bound method LiveReloadHandler.poll_tasks of <class 'livereload.handlers.LiveReloadHandler'>>
    Traceback (most recent call last):
      File "/Users/olivia/.mozbuild/srcdirs/gecko-467f003ac2da/_virtualenvs/docs/lib/python3.12/site-packages/tornado/ioloop.py", line 937, in _run
        val = self.callback()
              ^^^^^^^^^^^^^^^
      File "/Users/olivia/.mozbuild/srcdirs/gecko-467f003ac2da/_virtualenvs/docs/lib/python3.12/site-packages/livereload/handlers.py", line 69, in poll_tasks
        filepath, delay = cls.watcher.examine()
                          ^^^^^^^^^^^^^^^^^^^^^
      File "/Users/olivia/.mozbuild/srcdirs/gecko-467f003ac2da/_virtualenvs/docs/lib/python3.12/site-packages/livereload/watcher.py", line 119, in examine
        func()
      File "/Users/olivia/Repos/gecko/tools/moztreedocs/mach_commands.py", line 315, in _run_sphinx
        warnings = warn_file.readlines()
                   ^^^^^^^^^^^^^^^^^^^^^
      File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 369: ordinal not in range(128)

Reporting different setups because it also seemed slightly peculiar that the error message was different based on my mozbuild.

I tried updating to python@3.13/3.13.1 and the same result.

Not sure if I should be using a mozbuild Python or something, will look into that too, or if this is actually running into a special character of some sort.

You need to log in before you can comment on or make changes to this bug.