can't import six.moves module

994 Views Asked by At
import json

from six.moves.urllib_parse import urlencode
from six.moves.urllib_request import urlopen
from django.core.management.base import CommandError


def call(method, data, post=False):
    """
    Calls `method` from the DISQUS API with data either in POST or GET.
    Returns deserialized JSON response.
    """
    url = "%s%s" % ("http://disqus.com/api/", method)
    if post:
        # POST request
        url += "/"
        data = urlencode(data)
    else:
        # GET request
        url += "?%s" % urlencode(data)
        data = ""
    res = json.load(urlopen(url, data))
    if not res["succeeded"]:
        raise CommandError(
            "'%s' failed: %s\nData: %s" % (method, res["code"], data)
        )
    return res["message"]

module) moves
Import "six.moves.urllib_parse" could not be resolved from sourcePylancereportMissingModuleSource

installed the six module to Python virtual environment

six can be imported without problems,
Occurs from six.moves MissingModuleSource

Why can't Import? six.moves

1

There are 1 best solutions below

1
abi On

try changing system interpreter path of python in your IDE and set it to the virtual environment you use, in which you have installed the module.

an example in vscode