Tag Archives: unresolved reference

Pychorm prompts the unresolved reference import module to report an error

When pychorm is used to write Python recently, every time a custom module is introduced, an error will be reported and “unresolved reference” will be prompted

Unresolved reference ‘LoginClass’ more… (Ctrl+F1)  

This inspection detects names that should resolve but don’t. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.

Baidu tried many methods, but the results were useless. In the end, it was easy to solve it in one step. Everyone can try

Right click the folder where the called module exists, “markdictionary as” – & gt“ Sources root”

Check again and the error report disappears

 

The solution of unresolved reference in pychar

Just installed pychar, try to feel very good, I think this can calm down to experiment flash project. As a result, I typed the code according to the tutorial. Pychar always prompted me with “unresolved reference” in red. I was very depressed. It was clear that the code could run correctly. How could this kind of error occur

Red error prompt looked really upset, so I went to Baidu online for a circle, but I didn’t find a solution. Later, I saw someone encounter the same problem on stackoverflow, and successfully solved the problem according to the given method

In fact, it’s very simple. Right click on the directory, select mark directory as sources root, and add your project directory to sources root

Then, in the settings, check add source roots to pythonpath to add sources root to pythonpath

After the change of apply, there is no error prompt. Look

PS: when you use a template, you will also be prompted that you can’t find the template file. In fact, the code can run correctly. That’s why you set it in pychar. Here, you can also find the option of adding directory as template in the settings, and you can also set it to jinja2

Reference: unresolved reference issue in pycharm