file transfer through CLI to DBFS, working manually but not in python code...

pshuk
New Contributor III

Hi,

I ran my code sucessfully in the past but suddenly it stopped working. I have a python code that transfer local files to DBFS location using CLI. When I run the command manually on the screen, it works but in the code, it gives me the error  "returned non-zero exit status 127". Can anyone help me please... 

Here is the part of the code that was working fine but now it is not..

my_cmd = "databricks fs cp "+row_file+" "+upload_dir

                    run_args = {"shell":True, "check":True, "capture_output":True}

                    subprocess.run(my_cmd, **run_args)

and the my_cmd is this: databricks fs cp /mnt/farm/DNAlab/WGL/Samples/Data\ Analysis/Emedgene/HPO/2302706.HPO.txt dbfs:/FileStore/LiveDataUpload/WES_HPO_Dec16/

 

which runs fine if I copy it and execute it on shell prompt. any idea, what could be going wrong? TIA