Azure / azure-storage-python

Microsoft Azure Storage Library for Python
https://azure-storage.readthedocs.io
MIT License
338 stars 240 forks source link

creating a container by python for the first time results in error sometimes #587

Open vinuthakaranth opened 5 years ago

vinuthakaranth commented 5 years ago

Which service(blob, file, queue) does this issue concern?

blob

Which version of the SDK was used? Please provide the output of pip freeze.

adal==1.2.1 applicationinsights==0.11.8 asn1crypto==0.24.0 astroid==2.2.5 azure-common==1.1.18 azure-graphrbac==0.61.0 azure-mgmt-authorization==0.51.1 azure-mgmt-containerregistry==2.7.0 azure-mgmt-keyvault==1.1.0 azure-mgmt-nspkg==3.0.2 azure-mgmt-resource==2.1.0 azure-mgmt-storage==3.1.1 azure-nspkg==3.0.2 azure-storage-blob==1.5.0 azure-storage-common==1.4.0 azureml-core==1.0.31 azureml-dataprep==1.1.2 azureml-dataprep-native==12.0.1 azureml-pipeline==1.0.31 azureml-pipeline-core==1.0.31 azureml-pipeline-steps==1.0.31 azureml-sdk==1.0.31 azureml-telemetry==1.0.31 azureml-train==1.0.31 azureml-train-core==1.0.31 azureml-train-restclients-hyperdrive==1.0.31 backcall==0.1.0 backports.tempfile==1.0 backports.weakref==1.0.post1 bcrypt==3.1.6 certifi==2019.3.9 cffi==1.12.2 chardet==3.0.4 colorama==0.4.1 contextlib2==0.5.5 cryptography==2.6.1 decorator==4.4.0 distro==1.4.0 docker==3.7.2 docker-pycreds==0.4.0 dotnetcore2==2.1.8 idna==2.8 ipykernel==5.1.0 ipython==7.4.0 ipython-genutils==0.2.0 isodate==0.6.0 isort==4.3.16 jedi==0.13.3 jeepney==0.4 jmespath==0.9.4 jsonpickle==1.1 jupyter-client==5.2.4 jupyter-core==4.4.0 lazy-object-proxy==1.3.1 mccabe==0.6.1 mkl-fft==1.0.10 mkl-random==1.0.2 msrest==0.6.6 msrestazure==0.6.0 ndg-httpsclient==0.5.1 numpy==1.16.2 oauthlib==3.0.1 pandas==0.24.2 paramiko==2.4.2 parso==0.4.0 pathspec==0.5.9 pickleshare==0.7.5 pipe==1.5.0 prompt-toolkit==2.0.9 py4j==0.10.7 pyarrow==0.13.0 pyasn1==0.4.5 pycparser==2.19 Pygments==2.3.1 PyJWT==1.7.1 pylint==2.3.1 PyNaCl==1.3.0 pyOpenSSL==19.0.0 pypiwin32==223 pyspark==2.4.2 python-dateutil==2.8.0 pytz==2019.1 pywin32==224 pyzmq==18.0.1 requests==2.21.0 requests-oauthlib==1.2.0 ruamel.yaml==0.15.89 scikit-learn==0.20.3 scipy==1.2.1 SecretStorage==3.1.1 six==1.12.0 sspipe==0.1.6 tornado==6.0.2 traitlets==4.3.2 typed-ast==1.3.1 urllib3==1.24.2 wcwidth==0.1.7 websocket-client==0.56.0 wincertstore==0.2 wrapt==1.11.1

What problem was encountered?

I am trying to create a container using python in azure storage account. Please find the code used below. When I run the function to create a container for the first time, it gives me the error

AzureMissingResourceHttpError: The specified container does not exist. ErrorCode: ContainerNotFound <?xml version="1.0" encoding="utf-8"?>ContainerNotFoundThe specified container does not exist. RequestId:af0ea53c-401e-00f6-75b2-ff7c72000000 Time:2019-05-01T00:10:59.2735485Z

But when I run the same jupyter notebook cell for the second time it creates the container successfully.

Code Used to create container:

` def export_to_blob(p_df, container_name = None, relative_path = None, overwrite = True, show_progress = True, account_name = None, account_key = None):

    block_blob_service = BlockBlobService(account_name = account_name, account_key = account_key)
    container_name = container_name
    block_blob_service.create_container(container_name)
    block_blob_service.set_container_acl(container_name, public_access=PublicAccess.Container)`

create_container_error_11 create_container_error_2

I am able to reproduce the error by deleting the container created and running the jupyter cell again.

Please let me know if any further details is required.

Have you found a mitigation/solution?

No

Note: for table service, please post the issue here instead: https://github.com/Azure/azure-cosmosdb-python.

xiafu-msft commented 5 years ago

Hi @vinuthakaranth thanks for reaching out. We tried to use PyCharm reproduce the problem, however create_container() always worked. Here is the sample application. The file we ran is example.py