1
so I’m wanting to save a python file in a folder previous to the one running the script
ex:my script is in the /app/controllers/script.py directory i want to put the file I will create in the folder: /app/statics/download/Arq.zip
code:
import os.path
basedir = os.path.abspath(os.path.dirname(__file__))
localsalvar = basedir + '../statics/downloads/'
with open(localsalvar + id + '.zip', "w") as f:
f.write(cvcompacto)#criando o arquivo .zip
He is unable to move up the folder, thinking that '/.. /' is a folder
FileNotFoundError: [Errno 2] No such file or directory: '/root/extrator/app/controllers../statics/downloads/9837509907462335.zip'
Lucas, you have tried to put only the value '.. /Static/downloads/' without concatenating basedir?
– Daniel Mendes
Yes gives the same problem Filenotfounderror: [Errno 2] No such file or directory: '.. /statics/downloads/'
– Lucas Gabriel