theskumar / theskumar/python-dotenv

using set_key on a file over the network results in error

Abierto
#411 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Python
Estrellas
8.9k
Forks
581
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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)

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
tooling
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.