Ошибка при настройке виджета tkinter: объект 'NoneType' не имеет атрибута
Я запускаю приведенный ниже код, который работает нормально, когда я жестко закодировать значение
from nsetools import Nse
nse = Nse()
with open('all_nse_stocks') as nse_stocks:
for stock in nse_stocks:
q = nse.get_quote('INFY')
print q.get('open'), '\t', q.get('lastPrice'), '\t', q.get('dayHigh'), '\t', q.get('dayLow')
вижу, что я жестко запрограммировал значение nse.get_quote ('INFY'), но когда я запускаю следующий код, я получаю следующую ошибку:
from nsetools import Nse
nse = Nse()
with open('all_nse_stocks') as nse_stocks:
for stock in nse_stocks:
q = nse.get_quote(stock)
print q.get('open'), '\t', q.get('lastPrice'), '\t', q.get('dayHigh'), '\t', q.get('dayLow')
ОШИБКА:
Traceback (most recent call last):
File "test.py", line 6, in <module>
print q.get('open'), '\t', q.get('lastPrice'), '\t', q.get('dayHigh'), '\t', q.get('dayLow')
AttributeError: 'NoneType' object has no attribute 'get'
Пожалуйста помоги