Hy, everyone
I’ve created a export csv with the following code:
path_pedidos = st.text_input('Type folder to export files', 'C:/Downloads')
if st.button('Export'):
for file in os.scandir(path_pedidos):
if file.name.endswith(".csv"):
os.unlink(file.path)
# create a new folder on Compras\Pedidos with the date and a subfolder with nome_pedido
if not os.path.exists(path_pedidos+'/'+str(date.now().strftime('%Y-%m-%d'))+'/'+nome_pedido):
os.makedirs(path_pedidos+'/'+str(date.now().strftime('%Y-%m-%d'))+'/'+nome_pedido)
# EXPORT FILES
for i in pedidos['cad_fg'].unique():
pedidos[pedidos['cad_fg']==i][['cad_codigo','cad_cod_barra','cad_custo_medio','compra']].to_csv(path_pedidos+'/'+str(date.now().strftime('%Y-%m-%d'))+'/'+nome_pedido+'\\pedido_'+str(i)+'.csv', sep=';', decimal=',', encoding='latin_1', index=False)
User choose where to export the files and the code create a subfolder with current date and another subfolder with name of category (nome_pedido).
When I test this with streamlit run app.py, it works properly, but when I deploy it, I get the following error message:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Downloads'
It is the exactly same code and I’ve tested repeteadly and it does not work. Any ideas about the reason?
Thanks in advance for any help.