This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Script error json stack traceback:
#1
Hi there,
I use Always this script for weather condition

Code:
require('json')
require('socket.http')

socket.http.TIMEOUT = 5

local city = 716028
local data = socket.http.request('http://openrb.com/weather/?w=' .. city)

if not data then
 alert('Weather: cannot fetch data')
 return
end

data = json.pdecode(data)
if not data then
 alert('Weather: cannot parse data')
 return
end

-- current condition and temperature
-- grp.update('7/1/3', data.current.text, dt.string)
grp.update('7/1/4', data.current.temp)

-- forecast for today
grp.update('7/1/5', data.today.text, dt.string)
grp.update('7/1/6', data.today.low, dt.float16)
grp.update('7/1/7', data.today.high, dt.float16)

-- forecast for tomorrow
grp.update('7/1/8', data.tomorrow.text, dt.string)
grp.update('7/1/9', data.tomorrow.low, dt.float16)
grp.update('7/1/10', data.tomorrow.high, dt.float16)

grp.update('7/1/11', ((data.wind.chill-32)/1.8000), dt.float16)
grp.update('7/1/12', data.wind.direction, dt.angle)
grp.update('7/1/13', data.wind.speed, dt.float16)

grp.update('7/1/14', data.atmosphere.humidity, dt.float16)
grp.update('7/1/15', data.atmosphere.visibility, dt.float16)
grp.update('7/1/16', data.atmosphere.pressure, dt.float16)
grp.update('7/1/17', data.atmosphere.rising, dt.bool)

grp.update('7/1/18', data.astronomy.sunrise , dt.string)
grp.update('7/1/19', data.astronomy.sunset, dt.string)
I cannot understand the reason why in this case I read this following error:
Resident script:14: attempt to index global 'json' (a boolean value)

stack traceback:


What does it mean?

Thanks.
Reply


Messages In This Thread
Script error json stack traceback: - by Domoticatorino - 05.04.2018, 14:18

Forum Jump: