I am trying to pass a file from PHP into Python where I can upload to Azure Blob Storage via the Azure Python SDK.
PHP:
$output = shell_exec("/usr/bin/python /opt/UploadFile.py $filePath $container $blob");
die(var_dump($output));
Python:
import sys
from azure.storage import BlobService
upload = sys.argv[1];
container = sys.argv[2];
blob = sys.argv[3];
blob_service = BlobService(account_name='HIDDEN', account_key='HIDDEN')
try:
blob_service.put_block_blob_from_path(
continer,
blob,
upload
)
except:
print "error"
I am getting the catch exception. I have verified that the variables are coming over correctly from PHP. Not sure why its not working. I am new to Python what else can I do to debug that the .put_block_blob_from_path() is working?
I figured out if I added
print sys.exc_info()[1]
in the except:.
I would get a nice print of the error.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.