Skip to main content
Question

Update existing files via Python SDK

  • May 22, 2025
  • 2 replies
  • 73 views

Forum|alt.badge.img

Hi,

I need to update a file using the Python SDK. 

I know if a file exists and can get it's ID but can't find which Python SDK method to use. 

I've seen references to client.folder(box_folder_id).upload(WORK_PATH+item_file) and

chunked_uploader = client.file(item.id).get_chunked_uploader(item_file)
    uploaded_file = chunked_uploader.start()

 

But both throw this error: 

boxsdk.exception.BoxAPIException: Message: Item with the same name already exists
Status: 409
Code: item_name_in_use

 

Any suggestions?

2 replies

Forum|alt.badge.img

Hi 

You can use the 'update_contents' from the python SDK

https://github.com/box/box-python-sdk/blob/main/docs/usage/files.md#upload-a-new-version-of-a-file

Rgds,
Peter Christensen, Platform Solutions Engineer, Box


Forum|alt.badge.img

perfect - thank you!