1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-24 22:04:16 +00:00

Add stacktrace in warning message

This commit is contained in:
Paul Tremberth 2016-12-09 16:56:26 +01:00
parent 948e3cd003
commit f457379a54

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import traceback
import warnings
from zope.interface import implementer
@ -30,9 +31,9 @@ class SpiderLoader(object):
for module in walk_modules(name):
self._load_spiders(module)
except ImportError as e:
msg = ("Could not load spiders from module '{}'; "
"Check SPIDER_MODULES setting "
"(exception: {})".format(name, str(e)))
msg = ("\n{tb}Could not load spiders from module '{modname}'. "
"Check SPIDER_MODULES setting".format(
modname=name, tb=traceback.format_exc()))
warnings.warn(msg, RuntimeWarning)
@classmethod