Issue 903 in include-what-you-use: iwyu_tool.py fails with AttributeError: 'NoneType' object has no attribute 'rfind'

15 views
Skip to first unread message

notifi...@include-what-you-use.org

unread,
Apr 20, 2021, 1:13:59 PM4/20/21
to include-wh...@googlegroups.com
New issue 903 by SoftwareApe: iwyu_tool.py fails with AttributeError: 'NoneType' object has no attribute 'rfind'
https://github.com/include-what-you-use/include-what-you-use/issues/903

I got the tool to compile, however running `iwyu_tool` fails with the error message `iwyu_tool.py fails with AttributeError: 'NoneType' object has no attribute 'rfind'`.

On closer examination I found that the command starts with None. I traced it back to the global variable IWYU_EXECUTABLE.

For UX reasons if the executable can't be found it would be nice if it failed with an appropriate error message, e.g.

```python
IWYU_EXECUTABLE = find_include_what_you_use()
if IWYU_EXECUTABLE is None:
print("ERROR: Failed to find IWYU executable.", file=sys.stderr)
sys.exit(1)
```

notifi...@include-what-you-use.org

unread,
Apr 21, 2021, 2:21:44 PM4/21/21
to include-wh...@googlegroups.com
Comment #0 on issue 903 by kimgr: iwyu_tool.py fails with AttributeError: 'NoneType' object has no attribute 'rfind'
https://github.com/include-what-you-use/include-what-you-use/issues/903

Thank you for the report. Yes, this should definitely be handled more gracefully. I'll see if I can find some time to work on this.

Reply all
Reply to author
Forward
0 new messages