Unresolved references when specifying 2 sources root

Answered

I am trying to mark two directories as Sources Root in my project for autocompletion functionality:

  • src/opentelemetry-python/opentelemetry-api/src
  • src/opentelemetry-python/exporter/opentelemetry-exporter-zipkin/src

If I mark both directories as Sources Root, autocomplete only works for opentelemetry-api while the zipkin modules are unresolved.

 

If I mark only one of the directories as Sources Root, autocomplete works fine for that directory. For example with zipkin:

 

Interestingly, if I change the top-level module name for the zipkin source directory, it solves the issue, so it would seem that there is some type of conflict / overwrite occurring within the autocomplete functionality:

 

Here is my interpreter info:

 

Troubleshooting I've already tried:

  • Invalidate Cache / Restart - no effect
  • Delete & recreate python interpreter - no effect
  • Add src paths to the Python Interpreter instead of using the Sources Root GUI functionality - same issue
0
6 comments
Avatar
Permanently deleted user

Yes to namespacing - fyi the code I'm referencing and trying to import is https://github.com/open-telemetry/opentelemetry-python.

PY-202.7660.27, JRE 11.0.8+10-b944.34x64 JetBrains s.r.o., OS Windows 10(amd64) v10.0

 

0

It seems __init__.pyi file is the culprit.

Once it is removed, the code completion is working as expected.

This is a known issue with stub files https://youtrack.jetbrains.com/issue/PY-42428

0

I don't have __init__.pyi file and also face this issue. Is there any solution?

0

Hello Taojiahui92

 

Could you  upload a project example to the FTP

https://uploads.jetbrains.com/ and please let me know the filename?  Or please attach a couple of screenshots presenting the problem and the project structure. 

0

Hi Antonina,

Thank you for the quick response. The issue went away after I regenerating the package I'm working on. I don't really know what fixed it though.

0

Please sign in to leave a comment.