我正在尝试使用 urllib 从网络保存图像,但我不断收到此错误:
[Wed Oct 17 10:03:43 2012] [error] [client 223.232.227.124] urllib.urlretrieve(image,ban)
[Wed Oct 17 10:03:43 2012] [error] [client 223.232.227.124] File "/usr/lib/python2.6/urllib.py", line 93, in urlretrieve
[Wed Oct 17 10:03:43 2012] [error] [client 223.232.227.124] return _urlopener.retrieve(url, filename, reporthook, data)
[Wed Oct 17 10:03:43 2012] [error] [client 223.232.227.124] File "/usr/lib/python2.6/urllib.py", line 243, in retrieve
[Wed Oct 17 10:03:43 2012] [error] [client 223.232.227.124] tfp = open(filename, 'wb')
[Wed Oct 17 10:03:43 2012] [error] [client 223.232.227.124] IOError: [Errno 13] Permission denied: '/public/env/lib/python2.6/site-packages/project-0.0-py2.6.egg/project/images/series/graphical/104281-g2.jpg'
编码 :
ban='/public/env/project/project/images/series/%s'%(banner)
image='http://www.thetvdb.com/banners/%s'%(banner)
urllib.urlretrieve(image,ban)
该代码在我的本地主机上使用 Pyramid 服务员服务器以及使用 mod_wsgi 运行得非常好,但在生产服务器上却没有。
我正在使用 Pyramid 框架进行开发。