0

I need to transfer a file from my Azure ML workspace(notebooks folder) to a storage container. Tried this in jupyter notebook;

import azureml.core
from azureml.core import Workspace, Datastore
import json

subscription_id = 'key1'
resource_group = 'rg_grp'
workspace_name = 'dev'

workspace = Workspace(subscription_id, resource_group, workspace_name)

# get the datastore to upload prepared data
    datastore = Datastore.get(workspace, datastore_name='input')  # using an existing mapped datastore in azure ML

# upload the local file from src_dir to the target_path in datastore

datastore.upload_files(['./folder1/output.csv'], relative_root='folder1', target_path='folder1', overwrite=True, show_progress=True)

As soon as I run the block of code to upload, I get this error msg,

UserErrorException: UserErrorException:
    Message: './folder1/output.csv' does not point to a file. Please upload the file to cloud-first if running in a cloud notebook.
    InnerException None
    ErrorResponse 
{
    "error": {
        "code": "UserError",
        "message": "'./folder1/output.csv' does not point to a file. Please upload the file to cloud first if running in a cloud notebook."
    }
}

CSV file is already in my notebook.

Any help would be appreciated

Regards

adey27
  • 439
  • 3
  • 19

1 Answers1

0

I came across a similar issue very recently.

I believe, from looking at the docs - https://learn.microsoft.com/en-us/python/api/azureml-core/azureml.data.azure_storage_datastore.azureblobdatastore?view=azure-ml-py#upload-files-files--relative-root-none--target-path-none--overwrite-false--show-progress-true-

you need to be referencing the absolute path of where your file is stored but to my mind with using the dot notation at the start you are using a relative path which can't be used with this method.

so your value within the file list should go from:

'./folder1/output.csv'

to

'/root/subfolder/folder1/output.csv'

obviously making sure your root and subfolders are named correctly!

Hillygoose
  • 177
  • 8