0

I am working on a Django project having Django 2.1 version which was built 2 years ago and then never touched again and interestingly it was running successfully 2 years ago. now I want to run it successfully on local server. but when I type python manage.py runserver,
it gives me an error log which is given below. can anyone can guide me how to run it successfully? what part of the code should I look for to fix it?

Exception ignored in thread started by: <function check_errors.<locals>.wrapper at 0x0000013BF20405E0>
    Traceback (most recent call last):
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
        fn(*args, **kwargs)
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
        autoreload.raise_last_exception()
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\django\utils\autoreload.py", line 248, in raise_last_exception
        raise _exception[1]
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\django\core\management\__init__.py", line 337, in execute
        autoreload.check_errors(django.setup)()
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
        fn(*args, **kwargs)
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\django\__init__.py", line 24, in setup
        apps.populate(settings.INSTALLED_APPS)
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\django\apps\registry.py", line 120, in populate
        app_config.ready()
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\django\contrib\admin\apps.py", line 24, in ready
        self.module.autodiscover()
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\django\contrib\admin\__init__.py", line 26, in autodiscover
        autodiscover_modules('admin', register_to=site)
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\django\utils\module_loading.py", line 47, in autodiscover_modules
        import_module('%s.%s' % (app_config.name, module_to_search))
      File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 790, in exec_module
      File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\import_export\admin.py", line 33, in <module>
        from .resources import (
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\import_export\resources.py", line 4, in <module>
        import tablib
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\tablib\__init__.py", line 3, in <module>
        from tablib.core import (
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\tablib\core.py", line 15, in <module>
        from tablib import formats
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\tablib\formats\__init__.py", line 12, in <module>
        from . import _xlsx as xlsx
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\tablib\formats\_xlsx.py", line 14, in <module>
        import openpyxl
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\openpyxl\__init__.py", line 6, in <module>
        from openpyxl.workbook import Workbook
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\openpyxl\workbook\__init__.py", line 5, in <module>
        from .workbook import Workbook
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\openpyxl\workbook\workbook.py", line 8, in <module>
        from openpyxl.worksheet import Worksheet
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\openpyxl\worksheet\__init__.py", line 4, in <module>
        from .worksheet import Worksheet
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\openpyxl\worksheet\worksheet.py", line 35, in <module>
        from openpyxl.cell import Cell
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\openpyxl\cell\__init__.py", line 4, in <module>
        from .cell import Cell, WriteOnlyCell
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\openpyxl\cell\cell.py", line 46, in <module>
        from openpyxl.styles.styleable import StyleableObject
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\openpyxl\styles\styleable.py", line 11, in <module>
        from .builtins import styles
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\openpyxl\styles\builtins.py", line 1347, in <module>
        ('Normal', NamedStyle.from_tree(fromstring(normal))),
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\defusedxml\common.py", line 113, in fromstring
        parser = DefusedXMLParser(target=_TreeBuilder(),
      File "C:\Users\Dell\Documents\Satkardeep Django\wowtasks.com_django\venv\lib\site-packages\defusedxml\ElementTree.py", line 68, in __init__
        _XMLParser.__init__(self, html, target, encoding)
    TypeError: __init__() takes 1 positional argument but 4 were given
  • Check the link answer related to your error [takes-1-positional-argument-but-3-were-given](https://stackoverflow.com/questions/30032078/typeerror-init-takes-1-positional-argument-but-3-were-given) – Vignesh Apr 26 '22 at 17:06
  • @Vignesh I understand this error but I am not sure why is it giving me this error. I have navigated through your provided link and that's not what I am looking for. – djangodeveloper Apr 26 '22 at 17:48
  • You are trying to run it on a version of Python which is not compatible with the versions of your dependencies. See https://github.com/tiran/defusedxml/issues/29 . – solarissmoke Apr 27 '22 at 04:40
  • so what should I do now? will I need to upgrade the code as well? – djangodeveloper Apr 27 '22 at 05:09
  • I have read the comments and it seems there is an issue related to HTML argument. where I can find that argument so that I can remove it to fix the issue? – djangodeveloper Apr 27 '22 at 05:13
  • I have searched and found that "Django 2.1 supports Python 3.5, 3.6, and 3.7. Django 2.0 is the last version to support Python 3.4. We highly recommend and only officially support the latest release of each series." – djangodeveloper Apr 27 '22 at 05:17
  • @solarissmoke can you help me with that? I have no clear direction about it. – djangodeveloper Apr 27 '22 at 05:20
  • Your project is using an old version of `django-import-export`, which will not work with Python 3.7 or higher. You either need to use an old version of Python, or upgrade your dependencies - which means taking time to understand how the project is set up and what dependencies it is using. – solarissmoke Apr 27 '22 at 05:39
  • so do I need to only upgrade only django-import-export module only or do I need to upgrade all of the packages that are currently in my project? Apreciation for your help – djangodeveloper Apr 27 '22 at 06:02
  • my issue has been resolved. I downgraded python version from 3.9 to 3.7. – djangodeveloper May 08 '22 at 13:51

0 Answers0