'No warning at undefined variables in PyCharm Community 2017.2 [duplicate]
I have this piece of code in a Python module open in PyCharm Community Edition 2017.2.
class Sample(object):
def __init__(self):
self.prop1 = 5
self.prop2 = 10
def method1(self):
return foo
def do_work(self):
not_defined_func()
s = Sample()
s.method1()
bar = call_func
The IDE doesn't give any warnings on some fairly serious issues:
- The returned variable
foohas not been defined. - I assign not defined variable
call_functo the variablebar. - I call not defined function
not_defined_funcinside the methoddo_work.
How do I enable PyCharm to highlight these things? I have a fresh installation of PyCharm and have all the Inspections enabled in File > Settings > Editor > Inspections > Python.
Solution 1:[1]
See which python interpreter is enabled go to preference > Project > Project Interpreter. Set python interpreter and then apply it. Also check if inspections are enabled.
Solution 2:[2]
Go to Settings > Editor > Inspections and select Python, click settings icon and "Restore Defaults" then apply.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ZApatel |
| Solution 2 | Azikdev |
