I´m trying to download a file from Azure blob storage to to Azure Functions-App temp folder with python.
blobClient = BlobClient.from_connection_string(
conn_str = os.getenv('CONNECTION_STRING'),
container_name = 'data',
blob_name = 'data.csv'
)
filepath = os.path.join(tempfile.gettempdir(), 'data.csv')
with open(file = filepath, mode="wb") as file:
downloadStream = blobClient.download_blob()
file.write(downloadStream.readall())
On my local development environment it works well without any errors (connection string to cloud blob storgae, not local Azurite), but if i run the Functions-App on cloud environment I get following error:
Result: Failure Exception: HttpResponseError: The specifed resource name contains invalid characters.
[...]
line 366, in __init__ self._response = self._initial_request() File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/storage/blob/_download.py", line 466, in _initial_request process_storage_error(error) File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/storage/blob/_shared/response_handlers.py", line 189, in process_storage_error exec("raise error from None") # pylint: disable=exec-used # nosec File "<string>", line 1, in <module>
Same error appears for upload_blob() in other Functions-App.
I´ve found some similar questions and answers, like no special characters (naming convention) or only blob name not full path but nothing worked for me so far.



exists()on the blob client?