I'm using django 2.0.
What exactly is the purpose of django.utils.six.moves module?
I have read the source but don't quite understand. Seems like a poly-fill
of pre-existing libraries like urllib


On Mon, Apr 9, 2018 at 3:47 PM, Avraham Serour <[email protected]> wrote:

> sounds like django 2 removed six and some library you are using still
> hopes it exists.
>
> what django version are you using?
>
> On Mon, Apr 9, 2018 at 3:39 AM, Derek Zeng <[email protected]> wrote:
>
>> I got the following error when running pytest in django. Help is
>> appreciated.
>>
>> This is the test I run
>>
>> import pytest
>> from .factories import *
>>
>> @pytest.mark.django_db
>> def test_with_client(client):
>>   PostFactory.create() # if commented out, the error is gone
>>   response = client.get('/')
>>
>>   body = str(response.content)
>>   assert 'Mysite' in body
>>
>> PostFactory creates a Post object in the database
>>
>>
>> apps/blog/tests/test_post.py:5 (test_with_client)
>> client = <django.test.client.Client object at 0x1040cf3c8>
>> @pytest.mark.django_db
>> def test_with_client(client):
>> p = PostFactory.create()
>>
>> > response = client.get('/')
>> blog/tests/test_post.py:10:
>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>> _ _ _
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:517:
>> in get
>> response = super().get(path, data=data, secure=secure, **extra)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:332:
>> in get
>> return self.generic('GET', path, secure=secure, **r)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:404:
>> in generic
>> return self.request(**r)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:467:
>> in request
>> response = self.handler(environ)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:125:
>> in __call__
>> self.load_middleware()
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/
>> django/core/handlers/base.py:37: in load_middleware
>> middleware = import_string(middleware_path)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/
>> django/utils/module_loading.py:17: in import_string
>> module = import_module(module_path)
>> ../../../../.virtualenvs/django/lib/python3.6/importlib/__init__.py:126:
>> in import_module
>> return _bootstrap._gcd_import(name[level:], package, level)
>> <frozen importlib._bootstrap>:994: in _gcd_import
>> ???
>> <frozen importlib._bootstrap>:971: in _find_and_load
>> ???
>> <frozen importlib._bootstrap>:955: in _find_and_load_unlocked
>> ???
>> <frozen importlib._bootstrap>:665: in _load_unlocked
>> ???
>> <frozen importlib._bootstrap_external>:678: in exec_module
>> ???
>> <frozen importlib._bootstrap>:219: in _call_with_frames_removed
>> ???
>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>> _ _ _
>> from __future__ import absolute_import
>>
>> import re
>>
>> from django import http
>> from django.apps import apps
>> from django.utils.cache import patch_vary_headers
>> > from django.utils.six.moves.urllib.parse import urlparse
>> E ModuleNotFoundError: No module named 'django.utils.six.moves.urllib';
>> 'django.utils.six.moves' is not a package
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/corsheaders/middleware.py:8:
>> ModuleNotFoundError
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/23957c7e-9aca-4494-a06a-20cbf0fc857b%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/23957c7e-9aca-4494-a06a-20cbf0fc857b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/EmfIjFICjyU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAFWa6tJVq15fdBc8u%3DP6tRsrJo5D0sHNQtZh1a6U2y4uNm
> 38mw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFWa6tJVq15fdBc8u%3DP6tRsrJo5D0sHNQtZh1a6U2y4uNm38mw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAzyz%2BHvQDr_8uz_cgvWnp%3D3PgCLFN_GZE_tHGufTLJbALkg5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to