Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

下载文件到本地时出现如下错误 #111

Closed
hubberwisdom opened this issue Jan 24, 2015 · 8 comments
Closed

下载文件到本地时出现如下错误 #111

hubberwisdom opened this issue Jan 24, 2015 · 8 comments

Comments

@hubberwisdom
Copy link

首先非常谢谢作者开发这个非常好的工具!

我的百度网盘目录下/apps/bypy/abc这个目录,我使用
bypy.py syncdown abc ./想要把这个目录下载到当前目录下时,出现如下错误:

[13:53:03] Waiting 10 seconds before retrying...
[13:53:13] Request Try #2 / 5
[13:53:13] Waiting 20 seconds before retrying...
[13:53:33] Request Try #3 / 5
[13:53:34] Waiting 30 seconds before retrying...
[13:54:04] Request Try #4 / 5
[13:54:04] Waiting 40 seconds before retrying...
[13:54:44] Request Try #5 / 5
[13:54:44] Maximum number (5) of tries failed.
[13:54:45] Waiting 10 seconds before retrying...
[13:54:55] Request Try #2 / 5
[13:54:55] Waiting 20 seconds before retrying...
[13:55:15] Request Try #3 / 5
[13:55:15] Waiting 30 seconds before retrying...
[13:55:45] Request Try #4 / 5
[13:55:46] Waiting 40 seconds before retrying...
[13:56:26] Request Try #5 / 5
[13:56:26] Maximum number (5) of tries failed.
[13:56:27] Waiting 10 seconds before retrying...
[13:56:37] Request Try #2 / 5
[13:56:37] Waiting 20 seconds before retrying...
[13:56:57] Request Try #3 / 5
[13:56:57] Waiting 30 seconds before retrying...

@houtianze
Copy link
Owner

不客气。能运行加-d -v来跑,贴一下错误输出的调试信息吗?

@hubberwisdom
Copy link
Author

谢谢!

当我运行bypy.py syncdown abc ./ -d -v时,出现如下信息:

Token file: '/home/ubuntu/.bypy.json'
Hash Cache file: '/home/ubuntu/.bypy.pickle'
App root path at Baidu Yun '/apps/bypy'
sys.stdin.encoding = UTF-8
sys.stdout.encoding = UTF-8
Verbose level = 1

Debug = 1

Loading Hash Cache File '/home/ubuntu/.bypy.pickle'...
Hash Cache File loaded.
Token loaded:
{u'access_token': u'21.cfc35c9e28cf9c03d9d75f715dc2b08b.2592000.1424669452.2857989587-1572671', u'expires_in': 2592000, u'session_secret': u'23447b272b2d811ff780e205d4d55775', u'scope': u'basic netdisk', u'session_key': u'9mnRJ4EKjECXSVLkb5RRqZ8/9S/1HRuZxK6HhgEBywc/rnKXlJNwlUkWNIubIkIMew0w2F1NbyWfuwOhMagvZYwD2lg+HOtCXQ==', u'refresh_token': u'22.983705a3b199022545195decdb33933d.315360000.1737437452.2857989587-1572671'}
Gathering local directory ...

Done
Gathering remote directory ...
GET https://pcs.baidu.com/rest/2.0/pcs/file
actargs: ([], [])
Params: {u'path': u'/apps/bypy/abc', u'order': u'asc', u'method': u'list', u'by': u'name'}
HTTP Status Code: 200
Request OK, processing action
Request all goes fine
Remote dirs: []
Remote files: [{u'isdir': 0, u'ctime': 1422106389, u'fs_id': 196307507315005, u'mtime': 1422106389, u'path': u'/apps/bypy/abc/test(1).txt', u'md5': u'098f6bcd4621d373cade4e832627b4f6', u'size': 4}]
---- Remote Dir Contents ---
F - test(1).txt - size: 4 - md5: 098f6bcd4621d373cade4e832627b4f6

Done
Comparing ...
Done
Downloading '/apps/bypy/abc/test(1).txt' as './test(1).txt'
Getting info of remote file '/apps/bypy/abc/test(1).txt' for later verification
__get_file_info(): rdir : /apps/bypy/abc | rfile: test(1).txt
GET https://pcs.baidu.com/rest/2.0/pcs/file
actargs: /apps/bypy/abc/test(1).txt
Params: {u'path': u'/apps/bypy/abc', u'order': u'asc', u'method': u'list', u'by': u'name'}
HTTP Status Code: 200
Request OK, processing action
List json: {u'list': [{u'isdir': 0, u'ctime': 1422106389, u'fs_id': 196307507315005, u'mtime': 1422106389, u'path': u'/apps/bypy/abc/test(1).txt', u'md5': u'098f6bcd4621d373cade4e832627b4f6', u'size': 4}], u'request_id': 1678704572}
File info json: {u'isdir': 0, u'ctime': 1422106389, u'fs_id': 196307507315005, u'mtime': 1422106389, u'path': u'/apps/bypy/abc/test(1).txt', u'md5': u'098f6bcd4621d373cade4e832627b4f6', u'size': 4}
Request all goes fine
Checking if we already have the copy locally
GET https://d.pcs.baidu.com/rest/2.0/pcs/file
actargs: (u'/apps/bypy/abc/test(1).txt', 0, 4, 1422106409.0439)
Params: {u'path': u'/apps/bypy/abc/test(1).txt', u'method': u'download'}
[21:33:31] Error accessing 'https://d.pcs.baidu.com/rest/2.0/pcs/file'
[21:33:31] Exception: ('Connection aborted.', error(104, 'Connection reset by peer'))
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/bypy-1.0.3-py2.7.egg/EGG-INFO/scripts/bypy.py", line 1020, in __request_work
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 65, in get
return request('get', url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 49, in request
response = session.request(method=method, url=url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 461, in request
resp = self.send(prep, *_send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 599, in send
history = [resp for resp in gen] if allow_redirects else []
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 192, in resolve_redirects
allow_redirects=False,
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer'))

[21:33:31] Function: __downchunks_act
[21:33:31] Website parameters: {u'path': u'/apps/bypy/abc/test(1).txt', u'method': u'download'}
[21:33:31] Waiting 10 seconds before retrying...
[21:33:41] Request Try #2 / 5
GET https://d.pcs.baidu.com/rest/2.0/pcs/file
actargs: (u'/apps/bypy/abc/test(1).txt', 0, 4, 1422106409.0439)
Params: {u'path': u'/apps/bypy/abc/test(1).txt', u'method': u'download'}
[21:33:41] Error accessing 'https://d.pcs.baidu.com/rest/2.0/pcs/file'
[21:33:41] Exception: ('Connection aborted.', error(104, 'Connection reset by peer'))
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/bypy-1.0.3-py2.7.egg/EGG-INFO/scripts/bypy.py", line 1020, in __request_work
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 65, in get
return request('get', url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 49, in request
response = session.request(method=method, url=url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 461, in request
resp = self.send(prep, *_send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 599, in send
history = [resp for resp in gen] if allow_redirects else []
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 192, in resolve_redirects
allow_redirects=False,
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer'))

[21:33:41] Function: __downchunks_act
[21:33:41] Website parameters: {u'path': u'/apps/bypy/abc/test(1).txt', u'method': u'download'}
[21:33:41] Waiting 20 seconds before retrying...
[21:34:01] Request Try #3 / 5
GET https://d.pcs.baidu.com/rest/2.0/pcs/file
actargs: (u'/apps/bypy/abc/test(1).txt', 0, 4, 1422106409.0439)
Params: {u'path': u'/apps/bypy/abc/test(1).txt', u'method': u'download'}
[21:34:01] Error accessing 'https://d.pcs.baidu.com/rest/2.0/pcs/file'
[21:34:01] Exception: ('Connection aborted.', error(104, 'Connection reset by peer'))
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/bypy-1.0.3-py2.7.egg/EGG-INFO/scripts/bypy.py", line 1020, in __request_work
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 65, in get
return request('get', url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 49, in request
response = session.request(method=method, url=url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 461, in request
resp = self.send(prep, *_send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 599, in send
history = [resp for resp in gen] if allow_redirects else []
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 192, in resolve_redirects
allow_redirects=False,
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer'))

[21:34:01] Function: __downchunks_act
[21:34:01] Website parameters: {u'path': u'/apps/bypy/abc/test(1).txt', u'method': u'download'}
[21:34:01] Waiting 30 seconds before retrying...
^CSignal 2 received, Abort
Frame:

Not saving Hash Cache since 'dirty' is 'False' and 'force_saving' is 'False'

@houtianze
Copy link
Owner

这个error(104, 'Connection reset by peer')貌似是百度方面的问题,我不知道怎么解决。。

On Sat, Jan 24, 2015 at 9:35 PM, freedomjoke notifications@github.com
wrote:

谢谢!

当我运行bypy.py syncdown abc ./ -d -v时,出现如下信息:

Token file: '/home/ubuntu/.bypy.json'
Hash Cache file: '/home/ubuntu/.bypy.pickle'
App root path at Baidu Yun '/apps/bypy'
sys.stdin.encoding = UTF-8
sys.stdout.encoding = UTF-8
Verbose level = 1
Debug = 1

Loading Hash Cache File '/home/ubuntu/.bypy.pickle'...
Hash Cache File loaded.
Token loaded:
{u'access_token':
u'21.cfc35c9e28cf9c03d9d75f715dc2b08b.2592000.1424669452.2857989587-1572671',
u'expires_in': 2592000, u'session_secret':
u'23447b272b2d811ff780e205d4d55775', u'scope': u'basic netdisk',
u'session_key':
u'9mnRJ4EKjECXSVLkb5RRqZ8/9S/1HRuZxK6HhgEBywc/rnKXlJNwlUkWNIubIkIMew0w2F1NbyWfuwOhMagvZYwD2lg+HOtCXQ==',
u'refresh_token':
u'22.983705a3b199022545195decdb33933d.315360000.1737437452.2857989587-1572671'}
Gathering local directory ...

Done
Gathering remote directory ...
GET https://pcs.baidu.com/rest/2.0/pcs/file
actargs: ([], [])
Params: {u'path': u'/apps/bypy/abc', u'order': u'asc', u'method': u'list',
u'by': u'name'}
HTTP Status Code: 200
Request OK, processing action
Request all goes fine
Remote dirs: []
Remote files: [{u'isdir': 0, u'ctime': 1422106389, u'fs_id':
196307507315005, u'mtime': 1422106389, u'path':
u'/apps/bypy/abc/test(1).txt', u'md5': u'098f6bcd4621d373cade4e832627b4f6',
u'size': 4}]
---- Remote Dir Contents ---
F - test(1).txt - size: 4 - md5: 098f6bcd4621d373cade4e832627b4f6

Done
Comparing ...
Done
Downloading '/apps/bypy/abc/test(1).txt' as './test(1).txt'
Getting info of remote file '/apps/bypy/abc/test(1).txt' for later
verification
__get_file_info(): rdir : /apps/bypy/abc | rfile: test(1).txt
GET https://pcs.baidu.com/rest/2.0/pcs/file
actargs: /apps/bypy/abc/test(1).txt
Params: {u'path': u'/apps/bypy/abc', u'order': u'asc', u'method': u'list',
u'by': u'name'}
HTTP Status Code: 200
Request OK, processing action
List json: {u'list': [{u'isdir': 0, u'ctime': 1422106389, u'fs_id':
196307507315005, u'mtime': 1422106389, u'path':
u'/apps/bypy/abc/test(1).txt', u'md5': u'098f6bcd4621d373cade4e832627b4f6',
u'size': 4}], u'request_id': 1678704572}
File info json: {u'isdir': 0, u'ctime': 1422106389, u'fs_id':
196307507315005, u'mtime': 1422106389, u'path':
u'/apps/bypy/abc/test(1).txt', u'md5': u'098f6bcd4621d373cade4e832627b4f6',
u'size': 4}
Request all goes fine
Checking if we already have the copy locally
GET https://d.pcs.baidu.com/rest/2.0/pcs/file
actargs: (u'/apps/bypy/abc/test(1).txt', 0, 4, 1422106409.0439)
Params: {u'path': u'/apps/bypy/abc/test(1).txt', u'method': u'download'}
[21:33:31] Error accessing 'https://d.pcs.baidu.com/rest/2.0/pcs/file'
[21:33:31] Exception: ('Connection aborted.', error(104, 'Connection reset
by peer'))
Traceback (most recent call last):
File
"/usr/local/lib/python2.7/dist-packages/bypy-1.0.3-py2.7.egg/EGG-INFO/scripts/bypy.py",
line 1020, in __request_work
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 65, in
get
return request('get', url, *

kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/api.py",
line 49, in request response = session.request(method=method, url=url, *

kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line
461, in request
resp = self.send(prep, *

_send_kwargs) File
"/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 599, in
send history = [resp for resp in gen] if allow_redirects else [] File
"/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 192, in
resolve_redirects allow_redirects=False, File
"/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in
send r = adapter.send(request, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line
415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(104, 'Connection reset by
peer'))

[21:33:31] Function: __downchunks_act
[21:33:31] Website parameters: {u'path': u'/apps/bypy/abc/test(1).txt',
u'method': u'download'}
[21:33:31] Waiting 10 seconds before retrying...
[21:33:41] Request Try #2 #2 / 5
GET https://d.pcs.baidu.com/rest/2.0/pcs/file
actargs: (u'/apps/bypy/abc/test(1).txt', 0, 4, 1422106409.0439)
Params: {u'path': u'/apps/bypy/abc/test(1).txt', u'method': u'download'}
[21:33:41] Error accessing 'https://d.pcs.baidu.com/rest/2.0/pcs/file'
[21:33:41] Exception: ('Connection aborted.', error(104, 'Connection reset
by peer'))
Traceback (most recent call last):
File
"/usr/local/lib/python2.7/dist-packages/bypy-1.0.3-py2.7.egg/EGG-INFO/scripts/bypy.py",
line 1020, in __request_work
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 65, in
get
return request('get', url, *

kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/api.py",
line 49, in request response = session.request(method=method, url=url, *

kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line
461, in request
resp = self.send(prep, *

_send_kwargs) File
"/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 599, in
send history = [resp for resp in gen] if allow_redirects else [] File
"/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 192, in
resolve_redirects allow_redirects=False, File
"/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in
send r = adapter.send(request, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line
415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(104, 'Connection reset by
peer'))

[21:33:41] Function: __downchunks_act
[21:33:41] Website parameters: {u'path': u'/apps/bypy/abc/test(1).txt',
u'method': u'download'}
[21:33:41] Waiting 20 seconds before retrying...
[21:34:01] Request Try #3 #3 / 5
GET https://d.pcs.baidu.com/rest/2.0/pcs/file
actargs: (u'/apps/bypy/abc/test(1).txt', 0, 4, 1422106409.0439)
Params: {u'path': u'/apps/bypy/abc/test(1).txt', u'method': u'download'}
[21:34:01] Error accessing 'https://d.pcs.baidu.com/rest/2.0/pcs/file'
[21:34:01] Exception: ('Connection aborted.', error(104, 'Connection reset
by peer'))
Traceback (most recent call last):
File
"/usr/local/lib/python2.7/dist-packages/bypy-1.0.3-py2.7.egg/EGG-INFO/scripts/bypy.py",
line 1020, in __request_work
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 65, in
get
return request('get', url, *

kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/api.py",
line 49, in request response = session.request(method=method, url=url, *

kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line
461, in request
resp = self.send(prep, *

_send_kwargs) File
"/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 599, in
send history = [resp for resp in gen] if allow_redirects else [] File
"/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 192, in
resolve_redirects allow_redirects=False, File
"/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in
send r = adapter.send(request, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line
415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(104, 'Connection reset by
peer'))

[21:34:01] Function: __downchunks_act
[21:34:01] Website parameters: {u'path': u'/apps/bypy/abc/test(1).txt',
u'method': u'download'}
[21:34:01] Waiting 30 seconds before retrying...
^CSignal 2 received, Abort
Frame:

Not saving Hash Cache since 'dirty' is 'False' and 'force_saving' is
'False'


Reply to this email directly or view it on GitHub
#111 (comment).

@hubberwisdom
Copy link
Author

谢谢!我用bcloud也是存在这个问题,上传的时候都是卡住了,有可能是这边网关做了什么限制什么的。。。

@petronny
Copy link
Contributor

petronny commented Feb 3, 2015

你可以先试试我的这个fork

我用pycurl替换了__request_work()中的request.get(),应该能够正常下载

list和downfile功能是调通的,不过别的功能会出错
我知道原因,我会稍后改好然后发一个Pull Request。

@hubberwisdom
Copy link
Author

@houtianze , @petronny , 谢谢!

@myshowlo
Copy link

myshowlo commented May 3, 2016

-bash-4.1$ python bypy.py downdir -v
Loading Hash Cache File '/home/zengyingying/.bypy/bypy.hashcache.json'...
Hash Cache File loaded.
[11:15:32] Error accessing 'https://d.pcs.baidu.com/rest/2.0/pcs/file'
[11:15:32] Function: __downchunks_act
[11:15:32] Website parameters: {u'path': u'/apps/bypy/Ex-0h/RNA-5A_HL7WHCCXX_L1_1.clean.fq.gz', u'method': u'download'}
[11:15:32] Waiting 10 seconds before retrying...
[11:15:42] Request Try #2 / 5

求解答呀,这是什么问题呢?

@houtianze
Copy link
Owner

@myshowlo

程序在重试,如果没有出现重试失败可以不予理会。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants