Since updating my macbook to mojave I am unable to create a QApplication object in python2.7
Python 2.7.15 (default, Jan 9 2019, 18:18:40)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5 import QtWidgets
>>> _app = QtWidgets.QApplication(['any'])
qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Abort trap: 6
I've tried reinstalling python and pyqt (using homebrew), I made sure homebrew was up to date and fixed all the missing dependencies in brew doctor (there were a few warnings but they seem unrelated).
I guess I'm missing this cocoa plugin (I don't know what it's for) but I'm not sure where to install it from. I've found a few similar issues but they seem to relate to building an application - I'm not sure how I apply the fixes to running QApplication inside python.