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

TypeError: expected string or bytes-like object #501

Closed
AntonLazarchik opened this issue Jul 14, 2021 · 2 comments · Fixed by #505
Closed

TypeError: expected string or bytes-like object #501

AntonLazarchik opened this issue Jul 14, 2021 · 2 comments · Fixed by #505
Labels
api: storage Issues related to the googleapis/python-storage API.

Comments

@AntonLazarchik
Copy link

AntonLazarchik commented Jul 14, 2021

google-cloud-storage-1.41.0

Traceback (most recent call last):
File "", line 40, in
GoogleStorage().download_blob_as_string(uri='')
File "", line 23, in download_blob_as_string
return blob.download_as_string(retry=custom_retry)
File "\venv\lib\site-packages\google\cloud\storage\blob.py", line 1520, in download_as_string
warnings.warn(
TypeError: expected string or bytes-like object

print(type(_DOWNLOAD_AS_STRING_DEPRECATED))
warnings.warn(
_DOWNLOAD_AS_STRING_DEPRECATED, PendingDeprecationWarning, stacklevel=2
)
image

@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/python-storage API. label Jul 14, 2021
@nicwest
Copy link

nicwest commented Jul 14, 2021

_DOWNLOAD_AS_STRING_DEPRECATED = (
"Blob.download_as_string() is deprecated and will be removed in future. "
"Use Blob.download_as_bytes() instead.",
)

dangling comma at the end of the line

@nicwest
Copy link

nicwest commented Jul 14, 2021

same thing with _COMPOSE_IF_METAGENERATION_LIST_DEPRECATED

_COMPOSE_IF_METAGENERATION_LIST_DEPRECATED = (
"'if_metageneration_match: type list' is deprecated and supported for "
"backwards-compatability reasons only. Note that the metageneration to "
"be matched is that of the destination blob. Please pass in a single "
"value (type long).",
)

rjw57 added a commit to rjw57/python-storage that referenced this issue Jul 15, 2021
The _DOWNLOAD_AS_STRING_DEPRECATED constant includes a dangling comma
which makes it a tuple and not a string. This causes a TypeError as reported in googleapis#501.

Closes googleapis#501
rjw57 added a commit to rjw57/python-storage that referenced this issue Jul 15, 2021
The _DOWNLOAD_AS_STRING_DEPRECATED,
_COMPOSE_IF_GENERATION_LIST_DEPRECATED and
_COMPOSE_IF_GENERATION_LIST_AND_IF_SOURCE_GENERATION_ERROR constants
include a dangling comma which make them tuples and not strings. This
causes a TypeError as reported in googleapis#501.

Closes googleapis#501
gcf-merge-on-green bot pushed a commit that referenced this issue Jul 15, 2021
The _DOWNLOAD_AS_STRING_DEPRECATED constant includes a dangling comma
which makes it a tuple and not a string. This causes a TypeError as reported in #501.

Fixes #501
cojenco pushed a commit to cojenco/python-storage that referenced this issue Oct 13, 2021
)

The _DOWNLOAD_AS_STRING_DEPRECATED constant includes a dangling comma
which makes it a tuple and not a string. This causes a TypeError as reported in googleapis#501.

Fixes googleapis#501
cojenco pushed a commit to cojenco/python-storage that referenced this issue Oct 13, 2021
)

The _DOWNLOAD_AS_STRING_DEPRECATED constant includes a dangling comma
which makes it a tuple and not a string. This causes a TypeError as reported in googleapis#501.

Fixes googleapis#501
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/python-storage API.
Projects
None yet
2 participants