BbRest icon indicating copy to clipboard operation
BbRest copied to clipboard

UnboundLocalError

Open eflage opened this issue 7 months ago • 3 comments

I'm suddenly getting an error when I try and run any script that uses BbRest. It worked this morning, but failed around 1pm CDT. I wonder if Blackboard's latest release (121) broke something?

Traceback (most recent call last):
  File "c:\workspace\BbRest\bb_orientation_completion.py", line 30, in <module>
    bb = BbRest(key, secret, prod_url)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\Python312\Lib\site-packages\bbrest.py", line 130, in __init__
    self.supported_functions()
  File "C:\Python\Python312\Lib\site-packages\bbrest.py", line 195, in supported_functions
    parameters = clean_params(parameters)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\Python312\Lib\site-packages\bbrest.py", line 543, in clean_params
    ret_string += f"-----------------\n{prop_key}{type_str}{desc_str}{enum_str}{items_str}\n-----------------"
                                                  ^^^^^^^^
UnboundLocalError: cannot access local variable 'type_str' where it is not associated with a value

eflage avatar Jul 07 '25 19:07 eflage

I am also getting this error.

terrypatterson avatar Jul 09 '25 15:07 terrypatterson

Hello,

I had the same issue and a fix is to update virtualenv/your_app/3.8/lib/python3.8/site-packages/bbrest.py bbrest.py after line 530 make sure you have:

type_str = ""
desc_str = ""
enum_str = ""
items_str = ""

Hope this helps (don't forget to restart your app). I'll submit a PR for this soon or feel free to create one.

ajuszczyk avatar Jul 15 '25 09:07 ajuszczyk

On a hunch, I compared the .118 swagger file to the .121 swagger file and found a difference (attached).

Image

I sent an email to the developers@anthology team and this is the response I got.

It seems a few sprints ago a bug was introduced that affected the documentation and made things like that change.

Our team is identifying situations such as the one you reported and are working on it.

No ETA so far on when it will be solved (sorry!)

We are sorry for the inconveniences this may cause,

eflage avatar Jul 15 '25 13:07 eflage