Developing Techniques (and naming conventions)

Christian Heimes lists at cheimes.de
Sun Feb 24 13:06:09 EST 2008


Adekoba wrote:
> food.py
> food/
>       __init__.py
>       ham.py
>       cheese.py
> 
> where food.py is a script that uses the package food. Is it possible
> for this to work in any way? Every time I try to run food.py, python
> tries to import everything from the script instead of from the
> package. How can I fix this?

Move the code from food.py to food/__init__.py. You can't have a package
and a module with the same name.

Christian




More information about the Python-list mailing list