Skip to content

Instantly share code, notes, and snippets.

@tdhopper
Created April 24, 2013 20:26
Show Gist options
  • Select an option

  • Save tdhopper/5455267 to your computer and use it in GitHub Desktop.

Select an option

Save tdhopper/5455267 to your computer and use it in GitHub Desktop.
# 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)
@drvinceknight
Copy link

That puzzles me as well...

@jiffyclub
Copy link

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.

@NKT33
Copy link

NKT33 commented Apr 24, 2013

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