大家好,我正在运行以下 python 脚本以通过 libgmail 模块发送短信:
#!/usr/bin/env python
import libgmail
stuff = libgmail.GmailAccount("example@gmail.com", "password")
myCellEmail = "phonenumber@tmomail.net"
stuff.login()
msg=libgmail.GmailComposedMessage(myCellEmail, "", "Hello World! From python-libgmail!")
stuff.sendMessage(msg)
但是我收到以下错误:
Traceback (most recent call last):
File "./sms.py", line 7, in <module>
stuff.login()
File "/usr/local/lib/python2.7/dist-packages/libgmail.py", line 305, in login
pageData = self._retrievePage(req)
File "/usr/local/lib/python2.7/dist-packages/libgmail.py", line 340, in _retrievePage
req = ClientCookie.Request(urlOrRequest)
File "/usr/local/lib/python2.7/dist-packages/mechanize/_request.py", line 31, in __init__
if not _rfc3986.is_clean_uri(url):
File "/usr/local/lib/python2.7/dist-packages/mechanize/_rfc3986.py", line 62, in is_clean_uri
return not bool(BAD_URI_CHARS_RE.search(uri))
TypeError: expected string or buffer
libgmail 模块已安装在我想要的目录中,所以这不是问题。任何答案都会有所帮助,谢谢。