Skip to content

Commit

Permalink
Merge pull request #3896 from elacuesta/fix_configparser_import
Browse files Browse the repository at this point in the history
Fix ConfigParser import in py2
  • Loading branch information
Gallaecio committed Jul 23, 2019
2 parents b8a4301 + 7e622af commit bc8672c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scrapy/utils/conf.py
@@ -1,10 +1,13 @@
import os
import sys
import numbers
import configparser
from operator import itemgetter

import six
if six.PY2:
from ConfigParser import SafeConfigParser as ConfigParser
else:
from configparser import ConfigParser

from scrapy.settings import BaseSettings
from scrapy.utils.deprecate import update_classpath
Expand Down Expand Up @@ -94,7 +97,7 @@ def init_env(project='default', set_syspath=True):
def get_config(use_closest=True):
"""Get Scrapy config file as a ConfigParser"""
sources = get_sources(use_closest)
cfg = configparser.ConfigParser()
cfg = ConfigParser()
cfg.read(sources)
return cfg

Expand Down

0 comments on commit bc8672c

Please sign in to comment.