Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adagios/urls.py: ImportError: cannot import name 'patterns' #678

Open
tjyang opened this issue May 15, 2023 · 0 comments
Open

adagios/urls.py: ImportError: cannot import name 'patterns' #678

tjyang opened this issue May 15, 2023 · 0 comments

Comments

@tjyang
Copy link

tjyang commented May 15, 2023

adagios/urls.py need to be refactored to work with python3-django.

  • centos 7 with python2

[me@nagios01 tmp]$ sudo python -m pdb /usr/lib/python2.7/site-packages/adagios/manage.py test
> /usr/lib/python2.7/site-packages/adagios/manage.py(20)<module>()
-> import os
(Pdb) from django.conf.urls import url, patterns, include
(Pdb) c
Creating test database for alias 'default'...

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
Destroying test database for alias 'default'...
The program finished and will be restarted
> /usr/lib/python2.7/site-packages/adagios/manage.py(20)<module>()
-> import os
(Pdb)

  • rockylinux 8 with python3
[me@nagios03 pnp4nagios]$ sudo python3 -m pdb /usr/lib/python3.6/site-packages/adagios/manage.py test
> /usr/lib/python3.6/site-packages/adagios/manage.py(20)<module>()
-> import os
(Pdb) from django.conf.urls import url, patterns, include
*** ImportError: cannot import name 'patterns'
(Pdb) c
Traceback (most recent call last):
  File "/usr/lib64/python3.6/pdb.py", line 1667, in main
    pdb._runscript(mainpyfile)
  File "/usr/lib64/python3.6/pdb.py", line 1548, in _runscript
    self.run(statement)
  File "/usr/lib64/python3.6/bdb.py", line 434, in run
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/adagios/manage.py", line 20, in <module>
    import os
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/management/commands/test.py", line 23, in run_from_argv
    super().run_from_argv(argv)
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/management/commands/test.py", line 53, in handle
    failures = test_runner.run_tests(test_labels)
  File "/usr/lib/python3.6/site-packages/adagios/../django/test/runner.py", line 632, in run_tests
    self.run_checks()
  File "/usr/lib/python3.6/site-packages/adagios/../django/test/runner.py", line 570, in run_checks
    call_command('check', verbosity=self.verbosity)
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/management/__init__.py", line 148, in call_command
    return command.execute(*args, **defaults)
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/management/commands/check.py", line 64, in handle
    fail_level=getattr(checks, options['fail_level']),
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/management/base.py", line 390, in check
    include_deployment_checks=include_deployment_checks,
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/management/base.py", line 377, in _run_checks
    return checks.run_checks(**kwargs)
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/usr/lib/python3.6/site-packages/adagios/../django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/usr/lib/python3.6/site-packages/adagios/../django/urls/resolvers.py", line 399, in check
    for pattern in self.url_patterns:
  File "/usr/lib/python3.6/site-packages/adagios/../django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/lib/python3.6/site-packages/adagios/../django/urls/resolvers.py", line 584, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/lib/python3.6/site-packages/adagios/../django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/lib/python3.6/site-packages/adagios/../django/urls/resolvers.py", line 577, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3.6/site-packages/adagios/../adagios/urls.py", line 18, in <module>
    from django.conf.urls import url, patterns, include
ImportError: cannot import name 'patterns'
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /usr/lib/python3.6/site-packages/adagios/urls.py(18)<module>()
-> from django.conf.urls import url, patterns, include
(Pdb)

@tjyang tjyang changed the title RL8 with python3: ImportError: cannot import name 'patterns' adagios/urls.py n: ImportError: cannot import name 'patterns' Jun 1, 2023
@tjyang tjyang changed the title adagios/urls.py n: ImportError: cannot import name 'patterns' adagios/urls.py: ImportError: cannot import name 'patterns' Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant