Created
April 24, 2013 20:26
-
-
Save tdhopper/5455267 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Why does this work fine | |
| from rescrape.AbstractScraper import RecipeScraper | |
| RecipeScraper(url) | |
| # But this fails with "AttributeError: 'module' object has no attribute 'AbstractScraper'" | |
| import rescrape | |
| rescrape.AbstractScraper.RecipeScraper(url) |
It just depends on the structure of the package. In this case AbstractScraper isn't imported into the __init__.py file of rescrape so it's not loaded by just import rescrape. from rescrape.AbstractScraper ... actually goes and loads the AbstractScraper module/package.
This might explain why I've had so much trouble with getting stuff to import in Python! Hurrah! Shall investigate fully later.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That puzzles me as well...