getattr in thinkplot.py Config
grfiv opened this issue · 5 comments
grfiv commented
I am using your notebooks with Jupyter 4.2.1 and Python 3.5.2 under Ubuntu Desktop 16.10
The code snippet
def Config(**options):
for name in names:
if name in options:
getattr(pyplot, name)(options[name])
generates TypeError: 'tuple' object is not callable
The following seems to fix it for me
def Config(**options):
for name in names:
if name in options:
try:
getattr(pyplot, name)(options[name])
except TypeError:
setattr(pyplot, name, options[name])
AllenDowney commented
Thanks for reporting this. I'll investigate as soon as I get a change.
Can you tell me what parameters you are passing to Config?
…On Fri, Feb 24, 2017 at 12:35 PM, George Fisher ***@***.***> wrote:
I am using your notebooks with Jupyter 4.2.1 and Python 3.5.2
The code snippet
def Config(**options):
for name in names:
if name in options:
getattr(pyplot, name)(options[name])
generates TypeError: 'tuple' object is not callable
The following seems to fix it for me
def Config(**options):
for name in names:
if name in options:
try:
getattr(pyplot, name)(options[name])
except TypeError:
setattr(pyplot, name, options[name])
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#26>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABy37UBuTT_HQLP54LKgOXBMYxy3KzzDks5rfxTigaJpZM4MLeY3>
.
grfiv commented
http://localhost:8888/notebooks/code/chap02.ipynb
signal = thinkdsp.SquareSignal(100)
duration = signal.period*3
segment = signal.make_wave(duration, framerate=10000)
segment.plot()
thinkplot.config(ylim=[-1.05, 1.05], legend=False)
AllenDowney commented
Huh. I can't replicate that.
Just for debugging purposes, would you clone a fresh copy of the repo and
run that notebook again?
…On Fri, Feb 24, 2017 at 1:33 PM, George Fisher ***@***.***> wrote:
http://localhost:8888/notebooks/code/chap02.ipynb
signal = thinkdsp.SquareSignal(100)
duration = signal.period*3
segment = signal.make_wave(duration, framerate=10000)
segment.plot()
thinkplot.config(ylim=[-1.05, 1.05], legend=False)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#26 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABy37bdK9UADzXMEYV-9qGBM7e1nmwlXks5rfyKOgaJpZM4MLeY3>
.
grfiv commented
OK. Started fresh and it does not recur.
AllenDowney commented
Good news. Thanks for following up.