Reputation: 4521
This question is not about a specific error---the error arrises because I'm using matplotlib
's tight_layout
incorrectly.
I want to know why iPython is interpreting a line of code that I have commented out--or, rather, under what circumstances this is expected to happen (i.e., I need to relaunch the kernel, or whatever).
The error seems to persist, in spite of the fact that I re-executed the relevant imports.
Code:
import forecasting_report.analyze as fcst_rprt
analysis = fcst_rprt.ForecastingReport()
analysis.analyze()
results = analysis.user_dict
Error says:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-6-a62e6e8717be> in <module>()
1 analysis = fcst_rprt.ForecastingReport()
----> 2 analysis.analyze()
3 results = analysis.user_dict
/Users/[...]/ForecastingReport/forecasting_report/analyze.py in analyze(self)
44 self.breakdown = help.breakdown(self.user_dict)
---> 45 #plots.plot_breakdown(self.breakdown, self.path)
46
47 def write_results(self):
<Error Stack continues>
Note:
A perfectly fine answer is : "That's just not the way it works". To be sure, I haven't tried to reproduce this error at the command line, so it just may be my ignorance of the Python interpreter.
Upvotes: 3
Views: 1445
Reputation: 6736
try
%load_ext autoreload
%autoreload 2
which should work with ipython terminal, i not sure if it works in ipython notebook. You can view help through autoreload?
and this post: Autoreload of modules in IPython
Upvotes: 1
Reputation: 3906
Python will only initialise an imported module once, further calls to import
will have no effect, even if the module has been modified since being read.
To reload a module, use the builtin function reload on the already imported module object, e.g.:
import mymodule
# ...later...
reload(mymodule)
Upvotes: 1