Wei_Liu
February 14, 2019, 11:52am
1
Hi everyone!
I am trying to create a collection and upload images to the neurovault via the pynv (https://github.com/neurolearn/pynv ).
However, even though I double checked my access token (I recreated it several times even) and the pynv package, it did not work for me.
Without any error message, the new collection can be not added by the pynv. (It can be created using the website itself)
Other suggestions for uploading images are also welcomed!
Best,
Wei
Hi!
Same problem here… I can access some basic infos (api.my_collections() works), but I cannot create a collection, upload an image or anything else… Everytime, I can the following error:
pynv.exceptions.APIError: Permission denied
Has anybody managed to upload anything to neurovault with pynv?
Cheers,
Sylvain
Do you have a link to the code being used?
I know Neuroscout uploads to NeuroVault using this code:
MAP_TYPE_CHOICES = {
't': 'T',
'p': 'P',
'effect': 'U',
'variance': 'V',
}
def upload_neurovault(flask_app, file_id, n_subjects=None):
""" Upload image file to NeuroVault
Args:
file_id (int): NeurovaultFileUpload object id
n_subjects (int): Number of subjects in analysis
"""
api = Client(access_token=flask_app.config['NEUROVAULT_ACCESS_TOKEN'])
file_object = NeurovaultFileUpload.query.filter_by(id=file_id).one()
basename = Path(file_object.path).parts[-1]
contrast_name = re.findall('contrast-(.*)_', str(basename))[0]
@adelavega did you have to do anything special to get these uploads go?
The issue is that pynv
available on PyPi (pip) is out of date.
To install the latest github version, try:
pip install -e git+https://github.com/neurolearn/pynv#egg=pynv
One major issue is that the neurovault address is now https, so the old version of pynv is pushing to the wrong address.
I raised an issue. https://github.com/neurolearn/pynv/issues/20
@rwblair it may be worth forking this project and keeping it up to date, seeing if they would hand over the keys, or updating the alternate project (pyneurovault) which is also out of date.