rewrite always finishes with an error when the file is on a Windows host
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- docker, python
- Ambito
- devops, operating-systems
Direzione di ricerca
Start at save_envvar and trace set_key into the rewrite path shown in the report. Reproduce the .env update with a file on a Windows host or WSL2-mounted path, then verify that the update finishes without an error and that subsequent variables are written.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Trying to run iotedgedev in a docker container inside a WSL2 vm always yields the same error:
ERROR: Could not update the environment variable IOTHUB_CONNECTION_STRING in file /home/iotedge/.env
Funny thing is, the variable IS written to the file. What isn't written is the next variable, so clearly an error occurs AFTER having already written the value to the file.
Iotedgedev uses dotenv to update the .env file:
def save_envvar(self, key, value):
try:
dotenv_file = self.get_dotenv_file()
dotenv_path = os.path.join(os.getcwd(), dotenv_file)
set_key(dotenv_path, key, value)
except Exception:
raise IOError(f("Could not update the environment variable {key} in file {dotenv_path}"))
Now, set_key seems to be using rewrite to update the file, and rewrite does this:
if error is None:
shutil.move(dest.name, path)
else:
os.unlink(dest.name)
raise error from None
Instead of plain move it should first do an os.remove and only then move. That should make it work with files on a Windows host.
- Lingua principale
- Python
- Stelle
- 8.9k
- Fork
- 581
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di theskumar/python-dotenv
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
theskumar/python-dotenv#699 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
theskumar/python-dotenv#697 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
theskumar/python-dotenv#693 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
theskumar/python-dotenv#683 · 4 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
theskumar/python-dotenv#644 · 2 commenti ·
Tutte le issue di theskumar/python-dotenv
Issue simili
-
link-check link-check:sphinx-theme
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
OpenHands/extensions#626 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
CSCfi/sd-search-api#39 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100