【发布时间】:2014-08-03 09:34:55
【问题描述】:
所以我试图打开一个网站/url 在网站上提取一个 excel 文件,对其进行编辑,然后将其放在另一个网站上。我在这个网站上发现了另一条评论,它对如何使用 import pandas 进行此操作提供了很好的建议。
我从 python 网站下载了 pandas(和其他一些模块),并编写了代码。但是当我尝试运行它时,出现以下错误
Warning (from warnings module):
File "C:\Python27\lib\site-packages\pandas\io\excel.py", line 626
.format(openpyxl_compat.start_ver, openpyxl_compat.stop_ver))
UserWarning: Installed openpyxl is not supported at this time. Use >=1.6.1 and <2.0.0.
Traceback (most recent call last):
File "C:\Python27\more_url_stuff.py", line 6, in <module>
socket = urllib2.urlopen(link)
File "C:\Python27\lib\urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "C:\Python27\lib\urllib2.py", line 410, in open
response = meth(req, response)
File "C:\Python27\lib\urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Python27\lib\urllib2.py", line 448, in error
return self._call_chain(*args)
File "C:\Python27\lib\urllib2.py", line 382, in _call_chain
result = func(*args)
File "C:\Python27\lib\urllib2.py", line 531, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 401: Unauthorized
发生了什么事?
有没有更简单的方法可以从网上下载excel文件?
我上周刚开始使用 Python 编码,所以我仍然对一些简单的事情感到困惑。
【问题讨论】:
-
注意这一行:
Warning: Installed openpyxl is not supported at this time. Use >=1.6.1 and <2.0.0.。你的openpyxl是什么版本的? -
谢谢 - 我会努力解决这个问题。我什至不确定是哪个警告导致了所有问题。
-
我在哪里可以获得比 2.0.3 更早的 openpyxl 版本?