Python sees uninstalled module
Question: I have a really weird problem. I'm developing a Pyramid project and it seems
like **non-existing** module is found when I run `pserve`.

`__init__.py` of my main module:

    
    
    ...
    # This works !!! db/models directory does not even exists
    from db.models import Base
    # Also works - db/model exists
    from db.model import Base
    ...
    

I even tried to recreate my virtual environment and it still finds it.

Any ideas?


Answer: From the comments it appears this was solved and it was leftover `*.pyc`
files. This problem can come up a lot if you're moving between branches or if
you find yourself frequently renaming/deleting files.

`$ find mydir -name "*.pyc" -exec rm {} \;` will recursively find all `*.pyc`
files in the "mydir" directory (replace mydir with your directory name of
course) and delete them. `$ find . -name "*.pyc" -exec rm {} \;` for your
current working directory.

If you're using git for your project, add this script to your post-checkout
hook to prevent differences between branches from getting in your way.

`$ echo "find src -name "*.pyc" -exec rm {} \;" >> .git/hooks/post-checkout`

