Explore Courses Blog Tutorials Interview Questions
0 votes
in Azure by (5.8k points)

Azure ML Experiments provide ways to read and write CSV files to Azure blob storage through the Reader and Writer modules. However, I need to write a JSON file to blob storage. Since there is no module to do so, I'm trying to do so from within an Execute Python Script module.

# Import the necessary items

from import BlobService

def azureml_main(dataframe1 = None, dataframe2 = None):

    account_name = 'mystorageaccount'


    json_string='{jsonstring here}'

    blob_service = BlobService(account_name, account_key)


    # Return value must be of a sequence of pandas.DataFrame

    return dataframe1,

However, this results in an error: ImportError: No module named

This implies that the azure-storage Python package is not installed on Azure ML.

How can I write to Azure blob storage from inside an Azure ML Experiment?

Here's the full error message:

Error 0085: The following error occurred during script evaluation, please view the output log for more information:

---------- Start of error message from Python interpreter ----------

data:text/plain,Caught exception while executing function: Traceback (most recent call last):

  File "C:\server\", line 162, in batch

    mod = import_module(moduleName)

  File "C:\pyhome\lib\importlib\", line 37, in import_module


  File "C:\temp\", line 19, in <module>

    from import BlobService

ImportError: No module named

---------- End of error message from Python interpreter----------

Start time: UTC 02/06/2016 17:59:47

End time: UTC 02/06/2016 18:00:00`

1 Answer

0 votes
by (9.6k points)

Instead of using HTTPS, use HTTP to access Azure storage.

client = BlobService(STORAGE_ACCOUNT, STORAGE_KEY, protocol="http")

Download the Azure file that has required libraries and upload it as Data set in AML Studio. Connect it to Zip module from Execute Python script. Write your code and run the experiment.

Browse Categories