pywrap: AttributeError: 'NoneType' object has no attribute 'name'

Open
#132 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Reproduce the failure with the reported pywrap command and ocp.toml configuration. Start in bindgen/header.py at parse(), especially the get_includes() handling on line 707, then trace the callers through process_header() and ModuleInfo. Done means identifying the include that has no file location and establishing how the parser should handle it.

Written by the indexing model from the issue text.

Description

I'm packaging CadQuery for Gentoo, so i'm building OCP from sources. Running pywrap --verbose --njobs 9 --libclang /usr/lib/llvm/17/lib64/libclang.so --include /usr/lib/clang/17/include --include /usr/include/vtk-9.2 all ocp.toml on the 7.7.2.0 tag results in

  0% 0/314 [00:00<?, ?it/s][D 231211 14:02:49 module:41] Processing headers
[D 231211 14:02:49 module:44] ./opencascade/Standard_UUID.hxx
[D 231211 14:02:49 module:41] Processing headers
[D 231211 14:02:49 module:44] ./opencascade/math_GaussSetIntegration.hxx
[D 231211 14:02:49 module:41] Processing headers
[D 231211 14:02:49 module:44] ./opencascade/gp_Circ2d.hxx
[D 231211 14:02:49 module:41] Processing headers
[D 231211 14:02:49 module:44] ./opencascade/Quantity_NameOfColor.hxx
[D 231211 14:02:49 module:41] Processing headers
[D 231211 14:02:49 module:44] ./opencascade/TColgp_HSequenceOfXY.hxx
[D 231211 14:02:49 module:41] Processing headers
[D 231211 14:02:49 module:44] ./opencascade/OSD_ErrorList.hxx
[D 231211 14:02:49 module:41] Processing headers
[D 231211 14:02:49 module:44] ./opencascade/NCollection_BaseAllocator.hxx
[D 231211 14:02:49 module:41] Processing headers
[D 231211 14:02:49 module:44] ./opencascade/BVH_Sorter.hxx
[D 231211 14:02:49 module:41] Processing headers
[D 231211 14:02:49 module:44] ./opencascade/Storage_HArrayOfCallBack.hxx
[D 231211 14:02:50 module:41] Processing headers
[D 231211 14:02:50 module:44] ./opencascade/FSD_Base64.hxx
loky.process_executor._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/loky/process_executor.py", line 463, in _process_worker
    r = call_item()
        ^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/loky/process_executor.py", line 291, in __call__
    return self.fn(*self.args, **self.kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/joblib/parallel.py", line 589, in __call__
    return [func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/joblib/parallel.py", line 589, in <listcomp>
    return [func(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bindgen/__init__.py", line 246, in _process_module
    return ModuleInfo(name,path,files,module_names,settings)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bindgen/module.py", line 45, in __init__
    self.headers.append(process_header(p,prefix,settings,name))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bindgen/header.py", line 752, in process_header
    hi.parse(path,input_folder,settings,module_name)
  File "/usr/lib/python3.11/site-packages/bindgen/header.py", line 707, in parse
    self.dependencies = [el.location.file.name for el in tr_unit.get_includes()]
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bindgen/header.py", line 707, in <listcomp>
    self.dependencies = [el.location.file.name for el in tr_unit.get_includes()]
                         ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'name'
"""

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

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.11/pywrap", line 33, in <module>
    sys.exit(load_entry_point('pywrap==9999', 'console_scripts', 'pywrap')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bindgen/__main__.py", line 101, in all
    ctx.invoke(parse, configuration=configuration, output=tmp_parsed, platform=platform)
  File "/usr/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/decorators.py", line 45, in new_func
    return f(get_current_context().obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bindgen/__main__.py", line 40, in parse
    result = parse_modules(obj.verbose,obj.njobs,settings,module_mapping,module_settings,platform)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bindgen/__init__.py", line 248, in parse_modules
    modules = Parallel(prefer='processes',n_jobs=n_jobs)\
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/joblib/parallel.py", line 1952, in __call__
    return output if self.return_generator else list(output)
                                                ^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/joblib/parallel.py", line 1595, in _get_outputs
    yield from self._retrieve()
  File "/usr/lib/python3.11/site-packages/joblib/parallel.py", line 1699, in _retrieve
    self._raise_error_fast()
  File "/usr/lib/python3.11/site-packages/joblib/parallel.py", line 1734, in _raise_error_fast
    error_job.get_result(self.timeout)
  File "/usr/lib/python3.11/site-packages/joblib/parallel.py", line 736, in get_result
    return self._return_or_raise()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/joblib/parallel.py", line 754, in _return_or_raise
    raise self._result
AttributeError: 'NoneType' object has no attribute 'name'

What's wrong with it?

Dominant language
C++
Stars
200
Forks
48
Avg merge
1d 13h
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

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.

More from CadQuery/OCP

All issues in CadQuery/OCP

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.