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) |
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
It just depends on the structure of the package. In this case
AbstractScraperisn't imported into the__init__.pyfile of rescrape so it's not loaded by justimport rescrape.from rescrape.AbstractScraper ...actually goes and loads theAbstractScrapermodule/package.