After setting up an azure function using VScode, Python V2 on Windows & using quickstart directions, and sample from here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob-input?tabs=python-v2%2Cin-process&pivots=programming-language-python
Additionally I also set it up within a trigger to test:
@app.timer_trigger(schedule="*/5 * * * * *", arg_name="myTimer", run_on_startup=True,
use_monitor=False)
@app.blob_input(arg_name="inputblob",
path="samples/test.txt",
connection="AzureWebJobsStorage")
@app.blob_output(arg_name="outputblob",
path="newblob/test.txt",
connection="AzureWebJobsStorage")
#def TimerTrigger(myTimer: func.TimerRequest, inputblob: str, outputblob: func.Out[str]) -> None:
def TimerTrigger(myTimer, inputblob, outputblob) :
if myTimer.past_due:
logging.info('The timer is past due!')
logging.info('Python timer trigger function executed.')
logging.info(f'Python Queue trigger function processed {len(inputblob)} bytes')
outputblob.set(inputblob)
return "ok"
Consistently getting errors which are variations of:
Executed 'Functions.TimerTrigger' (Failed, Id=b1ab178c-e66a-4bbe-9ee6-bc9dc9241120, Duration=15ms) [2023-08-15T19:59:55.023Z] System.Private.CoreLib: Exception while executing function: Functions.TimerTrigger. System.Private.CoreLib: Result: Failure Exception: TypeError: object of type 'NoneType' has no len() Stack: File "C:\Users\T8\AppData\Roaming\nvm\v16.18.0\node_modules\azure-functions-core-tools\bin\workers\python\3.11\WINDOWS\X64\azure_functions_worker\dispatcher.py", line 479, in _handle__invocation_request call_result = await self._loop.run_in_executor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\T8\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures\thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\T8\AppData\Roaming\nvm\v16.18.0\node_modules\azure-functions-core-tools\bin\workers\python\3.11\WINDOWS\X64\azure_functions_worker\dispatcher.py", line 752, in _run_sync_func return ExtensionManager.get_sync_invocation_wrapper(context, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\T8\AppData\Roaming\nvm\v16.18.0\node_modules\azure-functions-core-tools\bin\workers\python\3.11\WINDOWS\X64\azure_functions_worker\extension.py", line 215, in _raw_invocation_wrapper result = function(**args) ^^^^^^^^^^^^^^^^ File "C:\Users\T8\source\repos\Q8Utilities\filefuncapp\function_app.py", line 50, in TimerTrigger logging.info(f'Python Queue trigger function processed {len(inputblob)} bytes')
Expecting this should just run. Updated to Python 3.11, same result.
I've tried providing the data_type parameter to the blob_input() argument list. Same result
I've also tried using InputStream for the blob & using the read() method. Same error.
def HttpTriggerFile(req: func.HttpRequest, obj: func.InputStream) -> func.HttpResponse: logging.info('Python HTTP trigger function processed a request.') logging.info(f'Python HTTP-triggered function processed: {obj.read()}')
What am I missing? Is the provided code incorrect? Some kind of setup issue?
Thanks

