Unable to access file I create locally.
Context: My Flask app fetches data and stores it in "data" folder. Corresponding Python code:
data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')
os.makedirs(data_dir, exist_ok=True)
print (f"data_dir is {data_dir}")
# Save the DataFrame to a CSV file in the 'data' directory
output_file = os.path.join(data_dir, f'stock_data_{ticker}.csv')
stock_data.to_csv(output_file)
I see Render is storing it at /opt/render/project/src/data/XYZ.csv
BUT it gives following error when trying to read from it
âError: File data\stock_data_VTEB.csv not found.â. Corresponding Pythong code-
ticker_filename = fâdata\stock_data_{ticker}.csvâ
data = pd.read_csv(ticker_filename )