Skip to content

ModuleNotFoundError: No module named 'refresh_compile_commands' #137

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

Closed
k355l3r-5yndr0m3 opened this issue Aug 9, 2023 · 4 comments
Closed

Comments

@k355l3r-5yndr0m3
Copy link

Executing bazel run :refresh_compile_commands produces this error.

Traceback (most recent call last):
  File "refresh_compile_commands.check_python_version.py", line 15, in <module>
    import refresh_compile_commands
ModuleNotFoundError: No module named 'refresh_compile_commands'

I'm using the latest commit (ecafb96)

@cpsauer
Copy link
Contributor

cpsauer commented Aug 10, 2023

Hey! Thanks for giving the tool a try and for writing in.

We're using the same commit internally (as you'd expect) and I'm not seeing the same error, unfortunately; I'm having trouble reproducing. I also tried running it in an empty bazel project and things ran successfully with both the latest bazel rolling and stable releases; so it's not dependent on some quirk of our .bazelrc.

Any idea what might be different about your setup? Some super old bazel version? Does it run cleanly in an empty project?

All the best,
Chris

@k355l3r-5yndr0m3
Copy link
Author

bazeltest.zip
running bazel run //binA:refresh_compile_commands from root directory emits the error as above. The version of bazel I use is 6.1.0, but the same issue is present in 6.3.2. However bazel run @hedron_compile_commands//:refresh_all is fine and does not produces any error.

@cpsauer
Copy link
Contributor

cpsauer commented Aug 11, 2023

Aha! 🤦🏻‍♂️ Yep, so the issue is that, in trying to get a better error message for folks who try to run this under very old python versions, I inadvertently broke support for calling refresh_compile_commands in sub-packages.

Most people put it in the top level BUILD file (probably because of the recommendation in the readme), so it'd gone unnoticed. Thanks so much for taking the time to bring it to my attention and help me understand.

I've pushed up a commit that I think will fix things. Could I ask you to give them a try and tell me how it goes?

@cpsauer cpsauer reopened this Aug 11, 2023
@k355l3r-5yndr0m3
Copy link
Author

Yes, (e160627) appears to fix it.

ngiloq6 added a commit to ngiloq6/bazel-compile-commands-extractor that referenced this issue Aug 17, 2024
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

No branches or pull requests

2 participants