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

"AttributeError: __enter__" #190

Open
sunnaa0423 opened this issue Feb 13, 2023 · 4 comments
Open

"AttributeError: __enter__" #190

sunnaa0423 opened this issue Feb 13, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@sunnaa0423
Copy link

The original version I used was 3.4.1, which I encountered an md5 mismatch during the download process.
Then I tried the 4.0.5 version according to your suggestion.The following problems were encountered:

####################################
[2023-02-13 21:35:24 +0800]
[2023-02-13 21:35:24 +0800] pyEGA3 - EGA python client version 4.0.5 (https://github.com/EGA-archive/ega-download-client)
[2023-02-13 21:35:24 +0800] Parts of this software are derived from pyEGA (https://github.com/blachlylab/pyega) by James Blachly
[2023-02-13 21:35:24 +0800] Python version : 3.10.9
[2023-02-13 21:35:24 +0800] OS version : Linux #1 SMP Thu Nov 8 23:39:32 UTC 2018
[2023-02-13 21:35:25 +0800] Server URL: https://ega.ebi.ac.uk:8052/elixir/data
[2023-02-13 21:35:25 +0800] Session-Id: 3372878956
[2023-02-13 21:35:27 +0800]
[2023-02-13 21:35:27 +0800] Authentication success for user '[email protected]'
[2023-02-13 21:36:18 +0800] File Id: 'EGAF00002027575'(8005749946 bytes).
[2023-02-13 21:36:18 +0800] Total space : 1056510.90 GiB
[2023-02-13 21:36:18 +0800] Used space : 421053.17 GiB
[2023-02-13 21:36:18 +0800] Free space : 582183.98 GiB
[2023-02-13 21:36:18 +0800] Download starting [using 1 connection(s), file size 8005749930 and chunk length 104857600]...
Status: 429 Problem with the request.

#########################################

Then it was updated to the latest version, 3.5.0, and there were new issues

#########################################
Status: 429 Problem with the request.
0%| | 0.00/8.01G [01:02<?, ?B/s]
[2023-02-13 21:35:07 +0800] enter
Traceback (most recent call last):
File "/xxx/.conda/envs/EBI/lib/python3.6/site-packages/pyega3/libs/data_file.py", line 326, in download_file_retry
self.download_file(output_file, num_connections, max_slice_size)
File "/xxx/.conda/envs/EBI/lib/python3.6/site-packages/pyega3/libs/data_file.py", line 159, in download_file
for part_file_name in executor.map(self.download_file_slice_, params):
File "/xxx/.conda/envs/EBI/lib/python3.6/concurrent/futures/_base.py", line 556, in result_iterator
yield future.result()
File "/xxx/.conda/envs/EBI/lib/python3.6/concurrent/futures/_base.py", line 405, in result
return self.__get_result()
File "/xxx/.conda/envs/EBI/lib/python3.6/concurrent/futures/_base.py", line 357, in __get_result
raise self.exception
File "/xxx/.conda/envs/EBI/lib/python3.6/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/xxx/.conda/envs/EBI/lib/python3.6/site-packages/pyega3/libs/data_file.py", line 189, in download_file_slice

return self.download_file_slice(*args)
File "/xxx/.conda/envs/EBI/lib/python3.6/site-packages/pyega3/libs/data_file.py", line 224, in download_file_slice
with self.data_client.get_stream(path, extra_headers) as r:
File "/xxx/.conda/envs/EBI/lib/python3.6/contextlib.py", line 82, in enter
return next(self.gen)
File "/xxx/.conda/envs/EBI/lib/python3.6/site-packages/pyega3/libs/data_client.py", line 76, in get_stream
with self.session.get(url, headers=headers, stream=True, timeout=request_timeout_in_sec) as r:
AttributeError: enter

#####################################

what should I do ? Can you help me with that? I have successfully downloaded almost half of the dataset.

@sunnaa0423 sunnaa0423 added the bug Something isn't working label Feb 13, 2023
@CsabaHalmagyi
Copy link
Contributor

Hi @sunnaa0423
Thank you for reporting this. May I ask you to update your client to the most recent version (v5.0.2) that should include a fix for md5 errors and try the download again?

@CsabaHalmagyi CsabaHalmagyi self-assigned this Mar 9, 2023
@cfusterot
Copy link

I am having the same error with v5.0.2. Any help will be very much appreciated!

[2023-05-03 12:06:13 +0200] Download starting [using 1 connection(s), file size 7150907281 and chunk length 104857600]...
  0%|                                                                                                                                                                                                   | 0.00/7.15G [00:07<?, ?B/s]
[2023-05-03 12:06:20 +0200] __enter__
Traceback (most recent call last):
  File "/data/gpfs-1/users/cofu10_c/work/miniconda/envs/pyega3/lib/python3.6/site-packages/pyega3/libs/data_file.py", line 323, in download_file_retry
    self.download_file(output_file, num_connections, max_slice_size)
  File "/data/gpfs-1/users/cofu10_c/work/miniconda/envs/pyega3/lib/python3.6/site-packages/pyega3/libs/data_file.py", line 159, in download_file
    for part_file_name in executor.map(self.download_file_slice_, params):
  File "/data/gpfs-1/users/cofu10_c/work/miniconda/envs/pyega3/lib/python3.6/concurrent/futures/_base.py", line 586, in result_iterator
    yield fs.pop().result()
  File "/data/gpfs-1/users/cofu10_c/work/miniconda/envs/pyega3/lib/python3.6/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/data/gpfs-1/users/cofu10_c/work/miniconda/envs/pyega3/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/data/gpfs-1/users/cofu10_c/work/miniconda/envs/pyega3/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/data/gpfs-1/users/cofu10_c/work/miniconda/envs/pyega3/lib/python3.6/site-packages/pyega3/libs/data_file.py", line 189, in download_file_slice_
    return self.download_file_slice(*args)
  File "/data/gpfs-1/users/cofu10_c/work/miniconda/envs/pyega3/lib/python3.6/site-packages/pyega3/libs/data_file.py", line 221, in download_file_slice
    with self.data_client.get_stream(path, extra_headers) as r:
  File "/data/gpfs-1/users/cofu10_c/work/miniconda/envs/pyega3/lib/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/data/gpfs-1/users/cofu10_c/work/miniconda/envs/pyega3/lib/python3.6/site-packages/pyega3/libs/data_client.py", line 76, in get_stream
    with self.session.get(url, headers=headers, stream=True, timeout=request_timeout_in_sec) as r:
AttributeError: __enter__

@sunnaa0423
Copy link
Author

Hi @sunnaa0423 Thank you for reporting this. May I ask you to update your client to the most recent version (v5.0.2) that should include a fix for md5 errors and try the download again?

Hi @CsabaHalmagyi
Thanks for the reply. After I updated to 5_0_2, I had a new problem. The data download connection was not stable, it was intermittent all the time. When I finally got to 100% , it showed MD5 check error. I felt very crash, is there any way to solve this problem? A concise version of the log file is attached.
pyega3_v5.0.2.log

@CsabaHalmagyi
Copy link
Contributor

Hi @sunnaa0423
Could you please confirm if this is still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants