Repository: bokeh/bokeh

Issue:
examples/app/spectrogram bug
When trying to run the spectrogram example, nothing displays.

<img width="1049" alt="screen shot 2017-08-10 at 2 02 07 pm" src="https://user-images.githubusercontent.com/1417520/29187228-9a07dd72-7dd4-11e7-86a2-cb0c9511dcdf.png">

Here is the error message on the command line

```$ bokeh serve --show spectrogram/
2017-08-10 13:59:56,791 Starting Bokeh server version 0.12.7dev16 (running on Tornado 4.4.2)
2017-08-10 13:59:56,797 Bokeh app running at: http://localhost:5006/spectrogram
2017-08-10 13:59:56,797 Starting Bokeh server with process id: 58630
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/Users/mmari/anaconda2/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/Users/mmari/anaconda2/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/Users/mmari/Desktop/OpenSource/continuum/bokeh/examples/app/spectrogram/audio.py", line 28, in update_audio_data
    frames_per_buffer=NUM_SAMPLES
  File "/Users/mmari/anaconda2/lib/python2.7/site-packages/pyaudio.py", line 747, in open
    stream = Stream(self, *args, **kwargs)
  File "/Users/mmari/anaconda2/lib/python2.7/site-packages/pyaudio.py", line 442, in __init__
    self._stream = pa.open(**arguments)
TypeError: integer argument expected, got float

2017-08-10 13:59:57,193 W-1001 (NO_DATA_RENDERERS): Plot has no data renderers: Figure(id='4736aae2-de2f-4f85-a248-0189dec2bae3', ...)
2017-08-10 13:59:59,806 200 GET /spectrogram (::1) 2735.09ms
2017-08-10 13:59:59,823 304 GET /static/css/bokeh.min.css?v=aff472d598b101a4d4a4c214f39d9604 (::1) 7.08ms
2017-08-10 13:59:59,824 304 GET /static/css/bokeh-widgets.min.css?v=86457bf4c63339205e6d8506debc72be (::1) 0.66ms
2017-08-10 13:59:59,825 304 GET /static/css/bokeh-tables.min.css?v=aa783ffa4e290813a295a99cce2f8b5d (::1) 0.47ms
2017-08-10 13:59:59,826 304 GET /static/js/bokeh-widgets.min.js?v=53e9333739b5b8282b798ee63e200477 (::1) 0.61ms
2017-08-10 13:59:59,828 304 GET /static/js/bokeh-tables.min.js?v=83bd509597a93515293f967dbad5bdc8 (::1) 0.53ms
2017-08-10 13:59:59,829 304 GET /static/js/bokeh-gl.min.js?v=d96d16e696eaa3d7d127cf62fadcfebf (::1) 0.63ms
2017-08-10 13:59:59,831 304 GET /static/js/bokeh.min.js?v=cd942061c2a5510352d403678a5c4671 (::1) 0.52ms
2017-08-10 13:59:59,890 Error thrown from periodic callback: TypeError("'NoneType' object is not iterable",)
2017-08-10 13:59:59,972 Error thrown from periodic callback: TypeError("'NoneType' object is not iterable",)
2017-08-10 14:00:00,018 200 GET /static/js/bokeh.min.js.map (::1) 20.62ms
2017-08-10 14:00:00,022 200 GET /static/js/bokeh-gl.min.js.map (::1) 3.32ms
2017-08-10 14:00:00,023 WebSocket connection opened
2017-08-10 14:00:00,023 ServerConnection created
2017-08-10 14:00:00,030 200 GET /static/js/bokeh-widgets.min.js.map (::1) 5.83ms
2017-08-10 14:00:00,036 200 GET /static/js/bokeh-tables.min.js.map (::1) 6.46ms
2017-08-10 14:00:00,053 Error thrown from periodic callback: TypeError("'NoneType' object is not iterable",)
2017-08-10 14:00:00,135 Error thrown from periodic callback: TypeError("'NoneType' object is not iterable",)
```

And the one in the console

<img width="1192" alt="screen shot 2017-08-10 at 2 00 53 pm" src="https://user-images.githubusercontent.com/1417520/29187247-a92a28b4-7dd4-11e7-9125-5d2008533dfd.png">


Discussion:
I uninstalled pyaudio 0.2.7, which caused the spectrogram to display synthetic data as expected, so it seems like that was the issue.

Resolving patch:
diff --git a/examples/app/spectrogram/audio.py b/examples/app/spectrogram/audio.py
--- a/examples/app/spectrogram/audio.py
+++ b/examples/app/spectrogram/audio.py
@@ -23,7 +23,7 @@ def update_audio_data():
         stream = pa.open(
             format=pyaudio.paInt16,
             channels=1,
-            rate=SAMPLING_RATE,
+            rate=int(SAMPLING_RATE),
             input=True,
             frames_per_buffer=NUM_SAMPLES
         )


Test patch: