Result: Failure Exception: OSError: [Errno 38] Function not implemented: Error
- Dominant language
- PowerShell
- Stars
- 1.1k
- Forks
- 215
- Avg merge
- 4h 2m
- Merged PRs (30d)
- 1
Description
### python function giving error in azure cloud but running locally fine
I have created 1 azure function(time trigger locally) and it was working fine. But when I deployed it on azure using Vs Code and ran then it was giving error like below which I was able to see in monitor tab in azure function:
2022-04-18 11:27:44.021
Result: Failure Exception: OSError: [Errno 38] Function not implemented: 'scraped_json_files/airbnb.json' -> 'scraped_json_files/airbnb2022-04-18_11-27-44.json' Stack: File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 402, in _handle__invocation_request call_result = await self._loop.run_in_executor( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 611, in _run_sync_func return ExtensionManager.get_sync_invocation_wrapper(context, File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/extension.py", line 215, in _raw_invocation_wrapper result = function(**args) File "/home/site/wwwroot/scraper_timer_trigger/__init__.py", line 35, in main os.rename(path,new_file_path).
below is the code of init.py file of the function.
import datetime
from distutils.log import log
import logging
import os
import azure.functions as func
def main(mytimer: func.TimerRequest) -> None:
utc_timestamp = datetime.datetime.utcnow().replace(
tzinfo=datetime.timezone.utc).isoformat()
if mytimer.past_due:
logging.info('The timer is past due!')
logging.info('Python timer trigger function ran at %s', utc_timestamp)
# os.system('echo "change directory to propertyscraper project"')
# os.system('cd ./propertyscraper')
# ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
os.system('echo "*****************************************************"')
logging.info(os.getcwd())
# os.system("echo $PWD")
logging.info(f"curret dir: {os.getcwd()}" )
logging.info("create directory: scraped_json_files")
os.makedirs("scraped_json_files", exist_ok=True)
os.system('echo "run airbnb spider"')
path = os.path.join("scraped_json_files","airbnb.json")
os.system(f"scrapy crawl airbnb -o {path}")
logging.info(f"current dir files:{os.listdir()}")
logging.info(f"previous dir files: {os.listdir('..')}")
file_creation_time = datetime.datetime.now().strftime(f'%Y-%m-%d_%H-%M-%S')
new_file_path = os.path.join("scraped_json_files","airbnb"+file_creation_time+".json")
# os.rename(path, f"./scraped_json_files/airbnb{file_creation_time}.json")
os.rename(path,new_file_path)
# os.rename("./scraped_json_files/airbnb.json", "scraped_json_files/airbnb_"+file_creation_time+".json")
below is the project structure which I have created locally in vs code.

in this image scraper_timer_trigger is the azure function name. scraper_function is the scrapy project. and other directories for storing files etc.
**guys plz help what am I doing wrong in here.**
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.