Hello,
I'm running a script adapted from https://github.com/cedricdonie/tsc-for-wrist-motion-pd-detection/blob/main/src/data/download_raw_data.py to download data programmatically, but the file download is failing during sync. The following error is shown:
```
SynapseMd5MismatchError(
synapseclient.core.exceptions.SynapseMd5MismatchError: Downloaded file d:\tremor\shimmer_rightwrist\patient3\rawdata_day2.txt.synapse_download_66520377's md5 b08baa124f3e396b0997ee6925176d45 does not match expected MD5 of 640d895bf3fc000b106debf43a831619
```
In more details, here are all output messages:
```
- Downloaded 1.6GB (6.4MB/s)Traceback (most recent call last):
File "C:\Users\j.luccas\AppData\Local\miniforge3\envs\tremor\lib\site-packages\synapseutils\sync.py", line 368, in _sync_file
entity = self._syn.get(
File "C:\Users\j.luccas\AppData\Local\miniforge3\envs\tremor\lib\site-packages\synapseclient\client.py", line 1339, in get
return_data = self._getWithEntityBundle(
File "C:\Users\j.luccas\AppData\Local\miniforge3\envs\tremor\lib\site-packages\synapseclient\client.py", line 1526, in _getWithEntityBundle
self._download_file_entity(
File "C:\Users\j.luccas\AppData\Local\miniforge3\envs\tremor\lib\site-packages\synapseclient\client.py", line 1648, in _download_file_entity
downloadPath = self._downloadFileHandle(
File "C:\Users\j.luccas\AppData\Local\miniforge3\envs\tremor\lib\site-packages\synapseclient\client.py", line 3269, in _downloadFileHandle
downloaded_path = self._download_from_url_multi_threaded(
File "C:\Users\j.luccas\AppData\Local\miniforge3\envs\tremor\lib\site-packages\synapseclient\client.py", line 3354, in _download_from_url_multi_threaded
raise SynapseMd5MismatchError(
synapseclient.core.exceptions.SynapseMd5MismatchError: Downloaded file d:\tremor\shimmer_rightwrist\patient3\rawdata_day2.txt.synapse_download_66520377's md5 b08baa124f3e396b0997ee6925176d45 does not match expected MD5 of 640d895bf3fc000b106debf43a831619
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "dataset_download.py", line 116, in
main(parser)
File "dataset_download.py", line 109, in main
files = synapseutils.syncFromSynapse(
File "C:\Users\j.luccas\AppData\Local\miniforge3\envs\tremor\lib\site-packages\synapseutils\sync.py", line 175, in syncFromSynapse
files = sync_from_synapse.sync(
File "C:\Users\j.luccas\AppData\Local\miniforge3\envs\tremor\lib\site-packages\synapseutils\sync.py", line 327, in sync
root_folder_sync = self._sync_root(
File "C:\Users\j.luccas\AppData\Local\miniforge3\envs\tremor\lib\site-packages\synapseutils\sync.py", line 434, in _sync_root
raise ValueError("File download failed during sync") from exception
ValueError: File download failed during sync
```
I have no idea of how to fix this. Can you give me instructions to solve this issue so I can get to download all data?
Thank you for your support,
Julia
Created by Julia Baldi de Luccas j.luccas Hi @j.luccas , it appears that your script is failing during the syncToSynapse call originally on [this line](https://github.com/cedricdonie/tsc-for-wrist-motion-pd-detection/blob/main/src/data/download_raw_data.py#L67). This is one way to download the data locally, but there's a more effective way that doesn't require you to parse the directory structure of the downloaded files to associate them with their metadata.
If you look at step 6 of [our "Accessing the Data" wiki](https://www.synapse.org/#!Synapse:syn20681023/wiki/594679), we provide instructions on how to download the data so that the end product is a dataframe with all its metadata (`subject_id`, `device`, `device_position`, etc.) and an additional field containing the local path to the downloaded data. This method of downloading the data (`downloadTableColumns` ) makes use of the client's cache so that if there are any interruptions to the download, you can run the same command and pick up where you left off.
While this is the standard way of working with files that are attached to Synapse tables, it may be the case that you have other scripts which depend on the data being organized in the custom directory structure defined in the script you have adapted (e.g., `tremor\shimmer_rightwrist\patient3\rawdata_day2.txt`). In that case it may make more sense to try the `syncToSynapse` command again (it will also pick up where it left off). If this fails, we can discuss workarounds.
One last thing: Can you share your `synapseclient` version in case this is a bug with the client and not a network error?