[Tutor] ImportError: cannot import name log
steve
steve at lonetwin.net
Thu Sep 17 17:11:19 CEST 2009
Hello Vishwajeet,
On 09/16/2009 11:21 PM, vishwajeet singh wrote:
> Hi,
>
> Below is the content of __init__.py
>
> import sys
> from django.core.signals import got_request_exception
> from . import log
> logger = log._get_logger()
>
> def got_request_exception_callback(sender, **kwargs):
> """Logging all unhandled exceptions."""
> type, exception, traceback = sys.exc_info()
> logger.error(unicode(exception))
> got_request_exception.connect(got_request_exception_callback)
>
> My question here is that what does *from . import log* doing I can see a
> module name log in the same folder.
>
The '.' notation is fairly new and also uncommon AFAIK
http://docs.python.org/tutorial/modules.html#intra-package-references
> This import statement is throwing an error ImportError: cannot import
> name log.
The reasons it can't import using this 'from . import' notation would be the
same as for any other import errors. Check your PYTHONPATH and paste the entire
traceback if it still does not work.
cheers,
- steve
--
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonehacks.blogspot.com/
what i'm stumbling into: http://lonetwin.stumbleupon.com/
More information about the Tutor
mailing list