“ERROR:tornado.application:Uncaught exception GET” when starting ipython-notebook

╄→гoц情女王★ 提交于 2019-12-08 19:28:27

I just had the same problem and please see my workaround:

The problem behind is that subkeyname variable contains an unreadable string for _winreg.OpenKey function. It's probably due to some Chinese software adding non-unicode values to the registry (Ali-Wangwang a top suspect). So you need to catch such exceptions and just bypass them.

Here is the original code starting from line 256:

with _winreg.OpenKey(hkcr, subkeyname) as subkey:
    # If there is no "Content Type" value, or if it is not
    # a simple string, simply skip
    try:
        mimetype, datatype = _winreg.QueryValueEx(
            subkey, 'Content Type')
    except EnvironmentError:
        continue
    if datatype != _winreg.REG_SZ:
        continue
    self.add_type(mimetype, subkeyname, strict)

Simply add a "try:...except" block to get over the WindowsError exception:

try:
    with _winreg.OpenKey(hkcr, subkeyname) as subkey:
        # If there is no "Content Type" value, or if it is not
        # a simple string, simply skip
        try:
            mimetype, datatype = _winreg.QueryValueEx(
                subkey, 'Content Type')
        except EnvironmentError:
            continue
        if datatype != _winreg.REG_SZ:
            continue
        self.add_type(mimetype, subkeyname, strict)
except EnvironmentError:
    continue

This works for me. Hope it helps.

    def enum_types(mimedb):
        i = 0
        while True:
            try:
                ctype = _winreg.EnumKey(mimedb, i)
            except EnvironmentError:
                break
            else:
                if '\0' not in ctype: # add this line to mimetypes.py
                    yield ctype
            i += 1
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!