您的位置:首页 > 编程语言 > Python开发

python之报错的解决(持续总结)

2015-10-26 11:54 579 查看
1 UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
今天在部署代码的时候,报了一个异常,经过百度后得知是 字符集问题,处理办法如下:
在文件前加两句话:

reload(sys)
sys.setdefaultencoding("utf-8")
2 使用requests 模块的时候报错:
C:\Python27\lib\site-packages\requests\packages\urllib3\util\ssl_.py:100: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuri
ng SSL appropriately and may cause certain SSL connections to fail. For more information,
see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning
是由于缺少一些ssl的支持包。解决办法:
pip install requests[security]
出处:http://stackoverflow.com/questions/29134512/insecureplatformwarning-a-true-sslcontext-object-is-not-available-this-prevent

本文出自 “一个奋斗的小运维” 博客,请务必保留此出处http://yucanghai.blog.51cto.com/5260262/1706267
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: