bulk download key error: token

New project for OpenCap, which is a new software package to estimate 3D human movement dynamics from smartphone videos. OpenCap strongly relies on OpenSim.
POST REPLY
User avatar
Faster Lab
Posts: 1
Joined: Mon Aug 14, 2023 10:32 am

bulk download key error: token

Post by Faster Lab » Mon Aug 14, 2023 10:36 am

Hello,

I have been trying to get the bulk download python script to run on our lab computers (windows 11), and I am getting this error back. I am able to download using the script on my personal computer (macOS Big Sur 11.7.8).
This is the traceback I am getting:
[ln2] runfile('C:/opencap-processing/batchDownload.py', wdir='C:/opencap-processing')
Login with credentials used at app.opencap.ai.
Visit the website to make an account if you do not have one.

Enter Username:
**************
Enter Password:
********************
Traceback (most recent call last):

File C:\opencap-processing\utilsAuthentication.py:35 in get_token
token = config("API_TOKEN")

File ~\anaconda3\Lib\site-packages\decouple.py:248 in __call__
return self.config(*args, **kwargs)

File ~\anaconda3\Lib\site-packages\decouple.py:107 in __call__
return self.get(*args, **kwargs)

File ~\anaconda3\Lib\site-packages\decouple.py:92 in get
raise UndefinedValueError('{} not found. Declare it as envvar or define a default value.'.format(option))

UndefinedValueError: API_TOKEN not found. Declare it as envvar or define a default value.


During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File C:\opencap-processing\utilsAuthentication.py:57 in get_token
token = resp['token']

KeyError: 'token'


During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File ~\anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
exec(code, globals, locals)

File c:\opencap-processing\batchdownload.py:21
from utils import download_session

File C:\opencap-processing\utils.py:37
API_TOKEN = get_token()

File C:\opencap-processing\utilsAuthentication.py:70 in get_token
raise Exception('Login failed.')

Exception: Login failed.


---------------

Any support would be greatly appreciated. We are trying to download sessions with 61 trials, and are unable to download them through the browser option.


Thank you,

Aera
FasTER Lab

User avatar
Antoine Falisse
Posts: 438
Joined: Wed Jan 07, 2015 2:21 am

Re: bulk download key error: token

Post by Antoine Falisse » Mon Aug 14, 2023 1:52 pm

Hi,

Thanks for reporting the bug, we'll investigate.

You can try to first run the createAuthenticationEnvFile.py file (https://github.com/stanfordnmbl/opencap ... EnvFile.py)? This should create an .env file in your directory You can then run any script without the need to authenticate again, this should solve your problem.

Best,
Antoine

User avatar
Dani Dresdner
Posts: 5
Joined: Tue Jan 31, 2023 1:50 pm

Re: bulk download key error: token

Post by Dani Dresdner » Thu Nov 02, 2023 11:17 am

We are getting a similar but slightly different error.


Traceback (most recent call last):
File "C:\opencap-core\Examples\batchDownloadData.py", line 61, in <module>
utils.downloadAndZipSession(session_id,justDownload=True,data_dir=downloadFolder,
File "C:\opencap-core\utils.py", line 858, in downloadAndZipSession
downloadVideosFromServer(session_id,neutral_id,isDocker=isDocker,
File "C:\opencap-core\utils.py", line 244, in downloadVideosFromServer
session_desc = getMetadataFromServer(session_id)
File "C:\opencap-core\utils.py", line 388, in getMetadataFromServer
session_desc["subjectID"] = subject_info['name']
KeyError: 'name'

When we run a single trial with the reprocesssession.py we have no problem.

Thanks.

User avatar
Scott Uhlrich
Posts: 124
Joined: Tue Jan 20, 2015 4:29 pm

Re: bulk download key error: token

Post by Scott Uhlrich » Mon Nov 06, 2023 12:46 pm

Hi Dani,

I wasn't able to replicate this error. Make sure you've pulled the latest version of the opencap-core code from github. If that doesn't solve it, could you provide me the list of session ids that I can use to reproduce the error?

Thanks,
Scott

POST REPLY