LSSTScienceCollaborations / StackClub

Learning the LSST software Stack, by writing jupyter notebook tutorials.
https://stackclub.readthedocs.io/
MIT License
45 stars 17 forks source link

where_is, NameError: name 'module' is not defined #234

Closed fforster closed 4 years ago

fforster commented 4 years ago

In version 20.0.0+3 I get an error when trying to use the where_is routine in the notebook GettingStarted/FindingDocs.ipynb

For example:

from lsst.pipe.tasks.imageDifference import ImageDifferenceTask
where_is(ImageDifferenceTask)

gives the error

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-25-764ad84f60e1> in <module>
      1 from lsst.pipe.tasks.imageDifference import ImageDifferenceTask
----> 2 where_is(ImageDifferenceTask)

<ipython-input-17-bf8ccab8f349> in where_is(object, in_the, assuming_its_a)
     36             modulename = 'lsst.pipe.tasks.'+objectname
     37 
---> 38     elif isinstance(object, module):
     39         # Locate the module that contains the desired object, and break its name into pieces:
     40         modulename = object.__module__

NameError: name 'module' is not defined
kadrlica commented 4 years ago

Colin suggests making a change to where_is.py

from types import ModuleType
isinstance(obj, ModuleType)

I'll take a look at this.