Reputation: 7285
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?
Upvotes: 1
Views: 519
Reputation: 7285
I figured out if I added
print sys.exc_info()[1]
in the except:.
I would get a nice print of the error.
Upvotes: 3