# SSUI-conky script problem

**URL:** https://forum.opendesktop.org/t/ssui-conky-script-problem/19660
**Category:** Discussion Board and Community
**Created:** [March 30, 2021, 10:08pm UTC](https://forum.opendesktop.org/t/ssui-conky-script-problem/19660 "2021-03-30T22:08:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![privasam](https://forum.opendesktop.org/user_avatar/forum.opendesktop.org/privasam/32/52433_2.png) [@privasam](https://forum.opendesktop.org/u/privasam)
#### Post date: [March 30, 2021, 10:08pm UTC](https://forum.opendesktop.org/t/ssui-conky-script-problem/19660/1 "2021-03-30T22:08:25Z")

</div>

Hello,  
I have a problem when running a conky script I have this error:

`modules/weather/scripts/fetch-weather.lua:71: attempt to index a nil value (field 'main')`

here is the portion of the script:

```
    if file_exists(cache_file) then
        cache = io.open(cache_file,"r+")
        data = json.decode(cache:read())
        timepassed = os.difftime(currenttime, data.timestamp)
    else
        cache = io.open(cache_file, "w")
        timepassed = 6000
    end

    makecache = function (s)
        s.timestamp = currenttime
        save = json.encode(s)
        cache:write(save)
    end

    if timepassed < 3600 then
        response = data
    else
        weather = http.request(("%sid=%s&units=%s&APPID=%s"):format(api_url, cityid, cf, apikey))
        if weather then
            response = json.decode(weather)
            makecache(response)
        else
            response = data
        end
    end

    math.round = function (n)
        return math.floor(n + 0.5)
    end

    temp = response.main.temp <----- error here 
    conditions = response.weather[1].main
    icon = response.weather[1].icon:sub(1, 2)
```
