Skip to content

Error: NameError: name 'unicode' is not definedΒ #38

@niciqy

Description

@niciqy

I am running in python 3.7. Encountering the following error when trying to create an endpoint

Uncaught exception GET /__manage (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/__manage', version='HTTP/1.1', remote_ip='::1', headers={'Host': 'localhost:8888', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36', 'Sec-Fetch-Dest': 'document', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Sec-Fetch-Site': 'same-origin', 'Sec-Fetch-Mode': 'navigate', 'Sec-Fetch-User': '?1', 'Referer': 'http://localhost:8888/__manage/create?url_path=&method=GET&status_code=200&format=json', 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'en-US,en;q=0.9', 'Cookie': 'csrftoken=MWWmqR1DGiHkAML7zrz1n0eoVdnlEkELXnj2PsqgbxxCZOlNCvbxzwSx3E0YGt0T; Pastease.passive.chance.kfzz9br7dC3Qwzl=1; Pastease.passive.activated.kfzz9br7dC3Qwzl=0; _ga=GA1.1.1041436616.1576026813; _xsrf=2|850e85be|11696f0fd78a46e6d9b1483a4522d35e|1583298649'})
    Traceback (most recent call last):
      File "/Users/corinel/.local/share/virtualenvs/trade-analysis-api-MP67PEe1/lib/python3.7/site-packages/tornado/web.py", line 1443, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/Users/corinel/.local/share/virtualenvs/trade-analysis-api-MP67PEe1/lib/python3.7/site-packages/mock_server/handlers.py", line 372, in get
        paths = resources_loader.load()
      File "/Users/corinel/.local/share/virtualenvs/trade-analysis-api-MP67PEe1/lib/python3.7/site-packages/mock_server/methodslisting.py", line 34, in load
        for item in os.walk(self.api_dir)
      File "/Users/corinel/.local/share/virtualenvs/trade-analysis-api-MP67PEe1/lib/python3.7/site-packages/mock_server/methodslisting.py", line 35, in <listcomp>
        if self._check_folder(item)]
      File "/Users/corinel/.local/share/virtualenvs/trade-analysis-api-MP67PEe1/lib/python3.7/site-packages/mock_server/methodslisting.py", line 55, in _complete_path
        url_path = UrlPath(get_url_path(item[0][len(self.api_dir):]))
      File "/Users/corinel/.local/share/virtualenvs/trade-analysis-api-MP67PEe1/lib/python3.7/site-packages/mock_server/methodslisting.py", line 107, in __init__
        self.id = slugify(self.path)
      File "/Users/corinel/.local/share/virtualenvs/trade-analysis-api-MP67PEe1/lib/python3.7/site-packages/mock_server/util.py", line 47, in slugify
        slug = unicodedata.normalize("NFKD", unicode(value)).encode("ascii", "ignore")
    NameError: name 'unicode' is not defined

Python 3 renamed the unicode type to str, the old str type has been replaced by bytes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions