Question

I'm going throgh Segaran's Programming Collective Intelligence using Windows version of PyPy.

The author is gradually building this example. First loading the dictionary with:

from recommendations import critics

recommendations.py is then modified by adding a new function. The reader is then supposed to reload the module with:

reload(recommendations)

Instead of successful reload I get this error instead:

>>>> reload(recommendations)
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: global name 'recommendations' is not defined

Am I doing something wrong?

Was it helpful?

Solution

The global is not there. You need to import recommendations for it to work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top