question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImportError: cannot import name log

See original GitHub issue

I’m trying to ue scrapy with django-dynamic-scraper, and getting this error when I start up the Django server:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 93, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 102, in inner_run
    self.validate(display_num_errors=True)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 310, in validate
    num_errors = get_validation_errors(s, app)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/usr/local/lib/python2.7/site-packages/django/db/models/loading.py", line 196, in get_app_errors
    self._populate()
  File "/usr/local/lib/python2.7/site-packages/django/db/models/loading.py", line 78, in _populate
    self.load_app(app_name)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load_app
    models = import_module('%s.models' % app_name)
  File "/usr/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/Users/nateaune/Dropbox/code/moocminder/moocminder/moocscraper/models.py", line 3, in <module>
    from scrapy.contrib.djangoitem import DjangoItem
  File "/usr/local/lib/python2.7/site-packages/scrapy/__init__.py", line 56, in <module>
    from scrapy.spider import Spider
  File "/usr/local/lib/python2.7/site-packages/scrapy/spider.py", line 6, in <module>
    from scrapy import log
ImportError: cannot import name log

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
kmikecommented, Jul 19, 2019

@rachelroll scrapy.log module has been removed in 1.7 version, after a long deprecation period. Please switch to stdlib logging.

0reactions
rachelrollcommented, Jul 19, 2019

@kmike Hi, I just installed the latest version of scrapy, but there is not log.py in “/usr/local/lib/python3.7/site-packages/scrapy”. So I still got the error: ImportError: cannot import name ‘log’ from ‘scrapy’ (/usr/local/lib/python3.7/site-packages/scrapy/init.py). Could you pls help with it. I appreciate that very much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: cannot import name log - python - Stack Overflow
If so python tries to import it before the math module. Solution: Just rename it to something else. Tip: In the future try...
Read more >
ImportError: cannot import name 'log' - Support - Zyte
Hi there, Having a bit of trouble with this one and can't seem to pinpoint the issue. This is on scraping hub, no...
Read more >
How to Fix ImportError: Cannot Import Name in Python - Rollbar
The imported class is in a circular dependency. · The imported class is unavailable or was not created. · The imported class name...
Read more >
[Tutor] ImportError: cannot import name log
module name log in the same folder. This import statement is throwing an error ImportError: cannot import name log. Thanks for all your...
Read more >
How can I solve it? ImportError: cannot import name 'Log' from ...
Traceback (most recent call last): File “/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found