AttributeError: 'Blob' object has no attribute 'download_as_bytes'
envgap__piskvorky__smart_open-601
01 / FAILURE SIGNATURE
As reported upstream
Error: AttributeError: 'Blob' object has no attribute 'download_as_bytes'
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
59d3a6079b523c030c78a3935622cf94405ce052- Manifest
setup.py- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
piskvorky/smart_open #601 · read the original issue
#### Problem description
Be sure your description clearly answers the following questions:
- What are you trying to achieve?
Trying to pull a file from gcp storage
- What is the expected result?
I can read a file from gcp storage
- What are you seeing instead?
Error: AttributeError: 'Blob' object has no attribute 'download_as_bytes'
#### Steps/code to reproduce the problem
Failed on this line: `for line in open(file, 'r'):`
I think it gets the file open and begins reading for the loop when it fails.
In order for us to be able to solve your problem, we have to be able to reproduce it on our end.
Without reproducing the problem, it is unlikely that we'll be able to help you.
Include full tracebacks, logs and datasets if necessary.
Please keep the examples minimal ([minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example)).
Apr 05 16:19:30 <host> docker[2234166]: File "/usr/local/lib/python3.7/site-packages/smart_open/gcs.py", line 325, in read1
Apr 05 16:19:30 <host> docker[2234166]: return self.read(size=size)
Apr 05 16:19:30 <host> docker[2234166]: File "/usr/local/lib/python3.7/site-packages/smart_open/gcs.py", line 320, in read
Apr 05 16:19:30 <host> docker[2234166]: self._fill_buffer(size)
Apr 05 16:19:30 <host> docker[2234166]: File "/usr/local/lib/python3.7/site-packages/smart_open/gcs.py", line 374, in _fill_buffer
Apr 05 16:19:30 <host> docker[2234166]: bytes_read = self._current_part.fill(self._raw_reader)
Apr 05 16:19:30 <host> docker[2234166]: File "/usr/local/lib/python3.7/site-packages/smart_open/bytebuffer.py", line 152, in fill
Apr 05 16:19:30 <host> docker[2234166]: new_bytes = source.read(size)
Apr 05 16:19:30 <host> docker[2234166]: File "/usr/local/lib/python3.7/site-packages/smart_open/gcs.py", line 178, in read
Apr 05 16:19:30 <host> docker[2234166]: binary = self._download_blob_chunk(size)
Apr 05 16:19:30 <host> docker[2234166]: File "/usr/local/lib/python3.7/site-packages/smart_open/gcs.py", line 194, in _download_blob_chunk
Apr 05 16:19:30 i<host> docker[2234166]: binary = self._blob.download_as_bytes(start=start, end=end)
Apr 05 16:19:30 <host> docker[2234166]: AttributeError: 'Blob' object has no attribute 'download_as_bytes'
Apr 05 16:19:30 <host> docker[2234166]: I0405 16:19:30.721222 139676694796096 gcs.py:241] close: called
#### Versions
Please provide the output of:
```python
import platform, sys, smart_open
print(platform.platform())
print("Python", sys.version)
print("smart_open", smart_open.__version__)
```
Python 3.7.10 (default, Apr 2 2021, 22:24:51)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform, sys, smart_open
>>> print(platform.platform())
Linux-5.4.89+-x86_64-with-debian-10.9
>>> print("Python", sys.version)
Python 3.7.10 (default, Apr 2 2021, 22:24:51)
[GCC 8.3.0]
>>> print("smart_open", smart_open.__version__)
smart_open 5.0.0
Tried on the latest 4 version too, same thing.
#### Checklist
Before you create the issue, please make sure you have:
- [x] Described the problem clearly
- [x] Provided a minimal reproducible example, including any required data
- [x] Provided the version numbers of the relevant software
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]