'Azure BlobServiceClient Error InvalidResourceName

Having problem uploading file to azure blob storage container, using azure.storage.blob for python 2.7. (I know i should use newer python, but it's a part of big ROS application, hence not just so to upgrade it all.)

from azure.storage.blob import BlobServiceClient
...
container_name = "operationinput"
self.back_up_root = "~/backup/sql/lp/"
self.back_up_root = os.path.expanduser(self.back_up_root)
file = 'test.sql'

try:
    client = BlobServiceClient.from_connection_string(conn_str=connection_string)
    blob = client.get_blob_client(container='container_name', blob='datafile')
except Exception as err:
    print(str(err))

with open(self.back_up_root + file, "rb") as data:
    blob.upload_blob(data)

I get the following error:

azure.core.exceptions.HttpResponseError: The specifed resource name contains invalid characters.
RequestId:3fcb6c26-101e-007e-596d-1c7d61000000
Time:2022-02-07T21:58:17.1308670Z
ErrorCode:InvalidResourceName

All post i have found refers to people using capital letters or so, but i have: operationinput datafile

All should be within specification.

Any ideas?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source