Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
332 stars 100 forks source link

Google Earth Engine API (ee) trying to import StringIO (depreciated) in azure cloud function - causing error #1279

Closed chrissimmerman closed 1 year ago

chrissimmerman commented 1 year ago

Greetings,

I have written an azure cloud function that invokes the Google Earth Engine API (ee). However, when I try to execute the function via http trigger, I get the following error:

Executed 'Functions.initial_extraction' (Failed, Id=31e5258f-4d5a-4625-a83b-f5891657e672, Duration=16ms)

Result: Failure Exception: ModuleNotFoundError: No module named 'StringIO'. Please check the requirements.txt file for the missing module. For more info, please refer the troubleshooting guide: https://aka.ms/functions-modulenotfound Stack: File "/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py", line 380, in _handlefunction_load_request func = loader.load_function( File "/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 48, in call raise extend_exception_message(e, message) File "/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 44, in call return func(*args, **kwargs) File "/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/loader.py", line 132, in load_function mod = importlib.import_module(fullmodname) File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/home/site/wwwroot/initial_extraction/init__.py", line 1, in import ee File "/home/site/wwwroot/.python_packages/lib/site-packages/ee/init.py", line 1, in from .main import main File "/home/site/wwwroot/.python_packages/lib/site-packages/ee/main.py", line 10, in import StringIO

I have modified the file on my local machine (located at C:\Users\chris\Desktop\ee.venv\Lib\site-packages\ee\main.py) to say "from io import StringIO" instead of "import StringIO",, but it does not seems to make a difference. I get the same error when I redeploy the function and trigger again.

Can anyone help?

bhagyshricompany commented 1 year ago

Thanks for reporting the issue. pls share the repro steps with your code.

ghost commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.