cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Subir archivos grandes. Upload Session error.

Subir archivos grandes. Upload Session error.

Matías
New member | Level 2

Estoy usando el siguiente código en Python para subir un archivo de más de 150MB a través de la API V2, pero en determinado punto obtengo el siguiente error: ApiError('22721c262fe77ea6ac8a66df83e76b3a', UploadSessionFinishError(u'path', WriteError(u'conflict', WriteConflictError(u'file', None))))

 

 

f = open(file_path)
file_size = os.path.getsize(file_path)

CHUNK_SIZE = 4 * 1024 * 1024

if file_size <= CHUNK_SIZE:

    print dbx.files_upload(f, dest_path)

else:

    upload_session_start_result = dbx.files_upload_session_start(f.read(CHUNK_SIZE))
    cursor = dropbox.files.UploadSessionCursor(session_id=upload_session_start_result.session_id,
                                               offset=f.tell())
    commit = dropbox.files.CommitInfo(path=dest_path)

    while f.tell() < file_size:
        if ((file_size - f.tell()) <= CHUNK_SIZE):
            print dbx.files_upload_session_finish(f.read(CHUNK_SIZE),
                                            cursor,
                                            commit)
        else:
            dbx.files_upload_session_append(f.read(CHUNK_SIZE),
                                            cursor.session_id,
                                            cursor.offset)
            cursor.offset = f.tell()

Necesitaria ayuda ya que es un script para generar backups. El archivo pesa algo más de 1GB.

 

3 Replies 3

Greg-DB
Dropbox Staff

Un error WriteConflictError.file como este indica que la subida falló porque ya hay un archivo en la ruta donde está intentando cargar el nuevo archivo. Puede utilizar una ruta de acceso diferente, eliminar el archivo existente o utilizar un modo de escritura diferente.

 

Puede configurar un modo en su CommitInfo para controlar lo que sucede en el caso de conflictos como este. La documentación de WriteMode tiene información sobre los diferentes modos.

 

---

Disculpe nuestras traducciones. Nuestras traducciones fueron creadas usando un traductor en línea. Nos gustaría apoyar todos los idiomas, pero no estamos preparados para hacerlo. Aquí está la versión Inglés:

---

Please excuse our translations. Our translations were created using an online translator. We'd like to support every language, but we're not currently equipped to do so. Here is the English version:

--- 

 

A WriteConflictError.file error like this indicates that the upload failed because there is already a file at the path where you're trying to upload the new file. You can either use a different path, delete the existing file, or use a different write mode.

 

You can set a mode in your CommitInfo to control what happens in the case of conflicts like this. The documentation for WriteMode has information on the different modes.

 

Matías
New member | Level 2

Definitely that was. Thanks!

DiegoAmorin
New member | Level 2
Gracias por todo y por la traducción ademas
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    DiegoAmorin New member | Level 2
  • User avatar
    Matías New member | Level 2
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?