S
S
Sergey Yavin2019-11-03 15:48:08
Python
Sergey Yavin, 2019-11-03 15:48:08

TypeError: 'NoneType' object is not subscriptable?

Here's a snippet of code:

def rezult_all_fight(jsonElements):
  value_games = jsonElements["Value"]["V"]
  for item in range(0, value_games): 
              #Тут основная логика программы
  #...
while True:
  rezult_all_fight(request_json())
  time.sleep(6)

When the program starts, it works for 15 minutes and gives an error TypeError: 'NoneType' object is not subscriptable points to value_games = jsonElements["Value"]["V"]. What could be the reason I can't figure it out? The variable type int value is always there, the data is taken from json by means of a request to the server.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Yavin, 2019-11-07
@sjaserds

The solution has been found! I don’t know if I did the right thing, but I wrapped everything in a try and processed except TypeError: print("Empty value")

D
datasciencetraining, 2020-09-10
@datasciencetraining

If you want to know above the topic visit : typeerror nonetype object is not subscriptable

S
shanamendez, 2022-01-07
@shanamendez

import math
print("The format you should consider:")
print str("value 1a")+str(" + ")+str("value 2")+str(" = ")+str("value 3a " )+str("value 4")+str("\n")
print("Do not include the letters in the input, it automatically adds them")
v1 = input("Value 1: ")
v2 = input(" Value 2: ")
v3 = input("Value 3: ")
v4 = input("Value 4: ")
lista = [v1, v3]
lista = list.sort(lista)
a = lista[1] - lista[0 ]
list = [v2, v4]
list = list.sort(list)
b = list[1] = list[0]
print str(a)+str("a")+str(" = ")+str(b )
check this code.
if you required more detail for any topic or professional essay writing servicethen visit my webpage.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question