Python:PyCurl集URL异常

Python:PyCurl集URL异常,python,curl,pycurl,Python,Curl,Pycurl,我尝试使用以下代码设置urlc.setopt(pycurl.url,link),但出现以下异常 File "/home/sultan/Repository/Django/monitor/app/thread/utils.py", line 164, in perform self.proxy_request.setopt(pycurl.URL, u'%s' % unicode(link)) TypeError: invalid arguments to setopt 我的代码有什么问

我尝试使用以下代码设置url
c.setopt(pycurl.url,link)
,但出现以下异常


File "/home/sultan/Repository/Django/monitor/app/thread/utils.py", line 164, in perform
    self.proxy_request.setopt(pycurl.URL, u'%s' % unicode(link))
TypeError: invalid arguments to setopt
我的代码有什么问题


Sultan

问题在于它接受字符串,而不是unicode对象。删除u和unicode()

问题在于它接受字符串,而不是unicode对象。删除u和unicode()


问题是它接受字符串,而不是unicode对象。删除u和unicode()

好的,但我有一个url:

这样行吗?不

我使用以下方法来解决此问题: url=str(url.encode('utf-8'))

我可能错了,如果有更好的办法,请纠正我


问题是它接受字符串,而不是unicode对象。删除u和unicode()

好的,但我有一个url:

这样行吗?不

我使用以下方法来解决此问题: url=str(url.encode('utf-8'))


我可能错了,如果有更好的方法,请纠正我。

您传递给c.setopt的链接参数类型正确吗?您传递给c.setopt的链接参数类型正确吗?