Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnboundLocalError: cannot access local variable 'data' where it is not associated with a value #147

Open
knutj opened this issue Jul 5, 2024 · 3 comments

Comments

@knutj
Copy link

knutj commented Jul 5, 2024

Traceback (most recent call last):
File "/home/knutjb/python311/bin/tacl", line 8, in
sys.exit(cli())
^^^^^
File "/home/knutjb/python311/lib64/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/knutjb/python311/lib64/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/knutjb/python311/lib64/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/knutjb/python311/lib64/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/knutjb/python311/lib64/python3.11/site-packages/tsdapiclient/tacl.py", line 644, in cli
resp = initiate_resumable(
^^^^^^^^^^^^^^^^^^^
File "/home/knutjb/python311/lib64/python3.11/site-packages/tsdapiclient/fileapi.py", line 813, in initiate_resumable
return _start_resumable(
^^^^^^^^^^^^^^^^^
File "/home/knutjb/python311/lib64/python3.11/site-packages/tsdapiclient/tools.py", line 190, in decorator
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/home/knutjb/python311/lib64/python3.11/site-packages/tsdapiclient/fileapi.py", line 914, in _start_resumable
upload_id = data['id']
^^^^
UnboundLocalError: cannot access local variable 'data' where it is not associated with a value

@haatveit
Copy link
Contributor

haatveit commented Jul 5, 2024

Hi, and thank you for filing an issue for this.

Can you please help us debug the problem by providing information about how you are invoking tacl when this exception occurs?

@knutj
Copy link
Author

knutj commented Jul 5, 2024

tacl p11 --upload local.tar.gz , I can not provide the user group or the name of the file. It is running on Fedora 41 with Python 3.11 as virtuelenv

@haatveit
Copy link
Contributor

Sorry about the late follow-up to this issue.

After investing the problem last week, I figured out that the specific problem you ran into was being caused by the code path responsible for retrying requests on temporary HTTP errors from the API, and wrote a fix for it in 2495a79.

As the retry manager would silently abort execution of code ran within its context, I unfortunately lack details about what exactly went wrong when you hit this issue in the first place, but most likely the API raised an error when tacl was attempting to initiate an upload session.

Have you ran into this bug again after making this issue? If it happens consistently, please contact our technical support team with details you can't provide publicly, and if possible, timestamps for when the problem occurred would be much appreciated.

I've published a small version update containing last week's fix:

https://pypi.org/project/tsd-api-client/3.5.15/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants