Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- testapp/
- ├── __init__.py
- ├── api
- │ ├── __init__.py
- │ └── utils.py
- └── utils.py
- from testapp import utils
- print "a", utils
- from testapp.api.utils import x
- print "b", utils
- x = 1
- $ export PYTHONPATH=$PYTHONPATH:.
- $ python -c "import testapp.api"
- a <module 'testapp.utils' from 'testapp/utils.pyc'>
- b <module 'testapp.api.utils' from 'testapp/api/utils.pyc'>
- >>> from os.path import abspath
- >>> path
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- NameError: name 'path' is not defined
- spam/
- __init__.py
- foo.py
- bar.py
- from .foo import Foo
- from .bar import Bar
- >>> import spam
- >>> spam.foo
- <module 'spam.foo' from '/tmp/imports/spam/foo.py'>
- >>> spam.bar
- <module 'spam.bar' from '/tmp/imports/spam/bar.py'>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement