pybind / pybind/pybind11_mkdoc

clang.cindex.TranslationUnitLoadError: Error parsing translation unit

Open
#28 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
44
Forks
24
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Hi, I'm trying to run the pybind11_mkdoc in a single file called score.h, but I got this error below:

C:\Users\nyck\Desktop\maialib>python -m pybind11_mkdoc maiacore\include\maiacore\score.h
Processing "'maiacore\include\maiacore\score.h'" ..
Waiting for jobs to finish ..
error: error reading ''maiacore\include\maiacore\score.h''
Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\nyck\AppData\Roaming\Python\Python310\site-packages\pybind11_mkdoc\mkdoc_lib.py", line 246, in run
    tu = index.parse(self.filename, self.parameters)
  File "C:\Users\nyck\AppData\Roaming\Python\Python310\site-packages\clang\cindex.py", line 2722, in parse
    return TranslationUnit.from_source(path, args, unsaved_files, options,
  File "C:\Users\nyck\AppData\Roaming\Python\Python310\site-packages\clang\cindex.py", line 2837, in from_source
    raise TranslationUnitLoadError("Error parsing translation unit.")
clang.cindex.TranslationUnitLoadError: Error parsing translation unit.

The file score.h is a valid C++ header that contains a valid Doxygen documentation in it.

Please, could you help me?

My system:

  • Windows 10 x64
  • Clang LLVM 15.0.6 installed
  • Python 3.10
  • pybind11_mkdoc-2.6.2.dev1 (filename=pybind11_mkdoc-2.6.2.dev1-py3-none-any.whl)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Windows command shown for score.h, then inspect pybind11_mkdoc/mkdoc_lib.py at the call to index.parse and the referenced clang/cindex.py parsing path. Done means the single-header command processes score.h without reporting an error reading the file or raising TranslationUnitLoadError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.