Tag Archives: PyCharm

How to fix PyCharm @staticmethod Error

When you run PyCharm with Python 2.7.2, you may see errors for @staticmethod annotations.  PyCharm marks your @staticmethod annotation as an error:

Screen Shot 2015-01-07 at 12.43.49 AM

When you mouse over, you see a failing the unresolved reference inspection:

Screen Shot 2015-01-07 at 12.44.10 AM

You can fix this issue by configuring Python 2.7.6 as the Project Interpreter:

Screen Shot 2015-01-07 at 12.40.57 AM

Screen Shot 2015-01-07 at 12.44.51 AM

To configure your Python Interpreter, select: PyCharm > Preferences… > Project: your_project > Project Interpreter.  You may have to install 2.7.6 or a newer version, for example, by clicking “+” in the OS X version of PyCharm.  Once you configure 2.7.6 PyCharm will update your indexes and, once that process completes, you will see a clean @staticmethod annotation:

Screen Shot 2015-01-07 at 12.45.14 AM