Cannot Access Microphone on Mac Mojave using pyaudio
For those who use PyCharm as their IDE, you follow these steps:

Run your microphone-using python script in Terminal (as @Yongke suggested)
Once prompted, allow Terminal to access Microphone
Close running PyCharm instances
Open PyCharm from terminal

cd /Applications/PyCharm\ CE.app/Contents/MacOS/
./pycharm

Now your recording app should work

Further explaination
Every App running on recent macOS versions needs explicit permissions to use the microphone. PyCharm doesn't request these permissions upon usage, i.e. when you run your script trying to record, and you cannot manually add a program to Mac's Microphone white-listed apps. This means you cannot access the microphone via PyCharm unless you run it within a white-listed app such as Terminal.
I'm trying to use pyaudio to record some speech but I can't seem to figure out how to record anything on a Mac running Mojave. I think that you have to allow access to the microphone on a mac but I'm not sure how.