theskumar / theskumar/python-dotenv
using set_key on a file over the network results in error
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 8.9k
- Fork
- 581
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
When trying to use set_key to create a .env file if one dosn't exist the first line works great but the second line always fails with this line because of the way that windows handles moving files across networks.
OSError: [WinError 17] The system cannot move the file to a different disk drive: 'C:\\Users\\[my username]\\AppData\\Local\\Temp\\tmpk0c72zk9' ->'N:\\[my username]\\Documents\\[project name]\\.env'
code that generates the error
# load the stuff that shouldn't be given out
user_config = dotenv_values(env_file_path)
if len(user_config) == 0:
module_logger.fatal('.env file with all of the needed stuff was empty. Creating it then exiting')
module_logger.debug(f'creating the .env file at {env_file_path.absolute()}')
env_file_path.touch()
module_logger.debug('setting the values inside the .env file')
set_key(env_file_path,'username','username') # <-- this line gets written to the file
set_key(env_file_path,'password','password') # <-- line that fails
set_key(env_file_path,'client_id','client id (tools>options>system settings)')
set_key(env_file_path,'client_secret','client secret (tools>options>system settings)')
sys.exit(1)
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.
Direzione di ricerca
Start at the set_key entry point and reproduce the shown sequence with env_file_path on a Windows network path. Compare the first and second calls and verify that repeated updates can create or update the .env file without the reported cross-drive error.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100