Programmatic Download on Synapse by Python

I'm trying run a code on Colab, but I've run into some issues while downloading data from Synapse.

Here is the download link for the data

Upon entering the website, clicking on the download option at the upper right corner reveals a programmatic option. I chose to download using Python.

You will then get a block of code as follows.

import synapseclient
import synapseutils

syn = synapseclient.Synapse() 
syn.login('synapse_username','password')
files = synapseutils.syncFromSynapse(syn, ' syn3193805 ')

enter image description here

However, I encountered recurring error message when running the code".

WARNING:synapseclient_default:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ifcollision=overwrite.localis being IGNORED because the download destination is synapse's cache. Instead, the behavior is "overwrite.local". 
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

At first, I noticed that there were unnecessary spaces on both sides of the file ID. I removed them, but I still encountered the same error."

-Before-

files = synapseutils.syncFromSynapse(syn, ' syn3193805 ')

-After-

files = synapseutils.syncFromSynapse(syn, 'syn3193805')

I also thought that this message may not affect the program's operation, so I waited for a long time. However, it remained stuck and continued to spin. enter image description here

Has anyone ever encountered a similar issue before? How can it be resolved? Thank you!

1 Answer

I think I have solved the problem myself. Just need to specify the download path for the data.

import synapseclient
import synapseutils

syn = synapseclient.Synapse()
syn.login('synapse_username','password')

destination_folder = "C:\\Users\\XXX\\Desktop\\Project"
files = synapseutils.syncFromSynapse(syn, 'syn3193805', path=destination_folder)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest