Skip to content

TypeError: 'NoneType' object is not subscriptable #2

@RiccardoRiglietti

Description

@RiccardoRiglietti

When running the main.py file I get the error:

127.0.0.1 - - [15/Sep/2022 18:57:41] "GET /getRandomImage?category=forever_alone HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/home/riccardo/anaconda3/lib/python3.8/site-packages/flask/app.py", line 2548, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/riccardo/anaconda3/lib/python3.8/site-packages/flask/app.py", line 2528, in wsgi_app
    response = self.handle_exception(e)
  File "/home/riccardo/anaconda3/lib/python3.8/site-packages/flask/app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/riccardo/anaconda3/lib/python3.8/site-packages/flask/app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/riccardo/anaconda3/lib/python3.8/site-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/riccardo/anaconda3/lib/python3.8/site-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/home/riccardo/Memeify/code/main.py", line 35, in getRandomImage
    data["upperText"] = random_caption[0]
TypeError: 'NoneType' object is not subscriptable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions