无法在python 3上执行urlparse

问题描述

我正在尝试:

self.host = urlparse(self.catalog_url).hostname

我还导入了urlparse,如:

from urllib.parse import urlparse`

但是当我将python从2.7升级到3.7时,以某种方式失败了。该库的名称已在py3中更改为urllib.parse,但即使我正确导入也仍然面临下面的问题!

self.host = urlparse(self.catalog_url).hostname
  File "/usr/lib/python3.7/urllib/parse.py",line 368,in urlparse
    splitresult = urlsplit(url,scheme,allow_fragments)
  File "/usr/lib/python3.7/urllib/parse.py",line 428,in urlsplit
    if i > 0:
TypeError: '>' not supported between instances of 'Magicmock' and 'int'

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)