Error al configurar el widget tkinter: el objeto 'NoneType' no tiene atributo

Estoy ejecutando el siguiente código que funciona bien cuando codifico el valor

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')

veo que he codificado el valor nse.get_quote ('INFY') Pero cuando ejecuto el siguiente código, aparece el siguiente error:

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')

ERROR:

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'

Por favor ayuda

Respuestas a la pregunta(2)

Su respuesta a la pregunta