I'm having problems with my own modules overriding built in Python ones (specifically the logging module). Here's my project layout:
run.py
package/
__init__.py
logging/
__init__.py
...
run.py
from package import main
main()
package/__init__.py
from __future__ import absolute_import
import logging
import logging.config
def main():
logging.config.fileConfig(...)
package/logging/__init__.py
class Logging(object):
pass
As it stands right now, the above code works. As soon as I try to import the Logging class from package.logging like so:
from __future__ import absolute_import
import logging
import logging.config
from package.logging import Logging
def main():
logging.config.fileConfig(...)
I get an error:
AttributeError: 'module' object has no attribute 'config'
I've read the PEP 328 release notes and found absolute imports to be rather straightforward. Unfortunately I haven't been able to figure this one out.
What am I missing here?