Installing PyAudio on macOS

Installing pyaudio on macOS is almost straightforward, except that you need portaudio installed. The easiest way to remedy this is to use homebrew. If you have your homebrew installing in the recomended location it is as simple as the following: brew install portaudio pipenv install pyaudio However if you have…

Python CSV Module Oddity

A Python Oddity I was using Python to encode a CSV file using a custom dialect recently when I noticed something odd. I noticed that the csv writer class takes an optional argument that enables you to change the line terminator.  That's ok, however, the csv reader class does not…

SSLError with Python 3.6.x on macOS Sierra

SSLError Have you ran into trouble with SSLErrors after upgrading to Python 3.6 on macOS Sierra?  For me, my first encounter was downloading the bokeh sample data (included here). Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits"…

Pip Installs From Github

Pip installs From github Installing a package from github is fairly simple.  The following are examples of installing packages from github. # Install repo package from the url, master branch pip3 install git+https://github.com/username/repo.git @ Install repo from the specified branch pip3 install git+https://github.com/username/repo.git@branch # Install repo from the specified commit.…

Odd Behavior in Python 2.7

I was tinkering around with replacing the print statement with the print function in a Python 2 script when I ran across this peculiar oddity. >>> from __future__ import print_function as print File "<stdin>", line 1 from __future__ import print_function as print ^ SyntaxError: invalid syntax >>> from __future__ import…

You're Too Close

Have you encountered the following scenario? You are trying to solve a problem (or helping solve a problem) and know or at least think you know the solution.  You are in the middle of implementing it when someone else looks at it and says, "why don't you do it this…