We're updating the issue view to help you get more done.Learn more

Command line client incompatible with cache changes

cacheDir is getting set to the wrong information which causes the cat command to fail in the command line client. Repro:

1 2 3 4 5 e = syn.get('syn8232164') In [7]: e.cacheDir Out[7]: u'mPower clinical data and timestamps 5.1.17.csv'

The failure code for command line hence becomes:

1 2 3 4 5 6 7 8 9 10 11 12 syn --debug cat syn8232164 Traceback (most recent call last): File "/usr/local/bin/synapse", line 11, in <module> load_entry_point('synapseclient', 'console_scripts', 'synapse')() File "/Users/lom/Dropbox/Sage/synapsePythonClient/synapseclient/__main__.py", line 806, in main perform_main(args, syn) File "/Users/lom/Dropbox/Sage/synapsePythonClient/synapseclient/__main__.py", line 778, in perform_main args.func(args, syn) File "/Users/lom/Dropbox/Sage/synapsePythonClient/synapseclient/__main__.py", line 257, in cat with open(os.path.join(entity['cacheDir'], filepath)) as inputfile: IOError: [Errno 20] Not a directory: u'mPower clinical data and timestamps 5.1.17.csv/mPower clinical data and timestamps 5.1.17.csv'

There appears to be two issues at hand here:

1) The recent caching/getWithEntityBundle code changed what we store in cacheDir - it should be the basepath to where the file is located
2) The cat() function in _main_ is using an older way of accessing the file location. It uses a for loop over ALL files that are associated with the entity which means it does a merge of the cacheDir and the entity.files variables. We are no longer supporting multiple files with an entity and should just use entity.filepath.



Ziming Dong


Larsson Omberg


Thomas Yu

Fix versions