# Buggy code
def msg_curse(self, args=None):
    """Return the dict to display in the curse interface."""
    # Init the return message
    ret = []

    # Only process if stats exist and display plugin enable...
    if not self.stats or self.is_disable():
        return ret

    # Build the string message
    msg = " - "
    ret.append(self.curse_add_line(msg))
    msg = "IP "
    ret.append(self.curse_add_line(msg, "TITLE"))
    msg = "{}".format(self.stats["address"])
    ret.append(self.curse_add_line(msg))
    if "mask_cidr" in self.stats:
        # VPN with no internet access (issue #842)
        msg = "/{}".format(self.stats["mask_cidr"])
        ret.append(self.curse_add_line(msg))
    try:
        msg_pub = "{}".format(self.stats["public_address"])
    except UnicodeEncodeError:
        pass
    else:
        if self.stats["public_address"] is not None:
            msg = " Pub "
            ret.append(self.curse_add_line(msg, "TITLE"))
            ret.append(self.curse_add_line(msg_pub))

    return ret


# Traceback (KeyError)
glances --export-restful
Traceback (most recent call last):
File "/usr/local/bin/glances", line 9, in <module>
load_entry_point('Glances==2.11.1', 'console_scripts', 'glances')()
File "/usr/local/lib/python2.7/dist-packages/glances/__init__.py", line 134, in main
start(config=config, args=args)
File "/usr/local/lib/python2.7/dist-packages/glances/__init__.py", line 103, in start
mode.serve_forever()
File "/usr/local/lib/python2.7/dist-packages/glances/standalone.py", line 117, in serve_forever
vagrant@vagrant-ubuntu-trusty-64:~$ glances --export-restful
Traceback (most recent call last):
File "/usr/local/bin/glances", line 9, in <module>
load_entry_point('Glances==2.11.1', 'console_scripts', 'glances')()
File "/usr/local/lib/python2.7/dist-packages/glances/__init__.py", line 134, in main
start(config=config, args=args)
File "/usr/local/lib/python2.7/dist-packages/glances/__init__.py", line 103, in start
mode.serve_forever()
File "/usr/local/lib/python2.7/dist-packages/glances/standalone.py", line 117, in serve_forever
self.schedule.run()
File "/usr/lib/python2.7/sched.py", line 117, in run
action(*argument)
File "/usr/local/lib/python2.7/dist-packages/glances/standalone.py", line 104, in __serve_forever
self.screen.update(self.stats)
File "/usr/local/lib/python2.7/dist-packages/glances/outputs/glances_curses.py", line 978, in update
self.flush(stats, cs_status=cs_status)
File "/usr/local/lib/python2.7/dist-packages/glances/outputs/glances_curses.py", line 956, in flush
self.display(stats, cs_status=cs_status)
File "/usr/local/lib/python2.7/dist-packages/glances/outputs/glances_curses.py", line 528, in display
__stat_display = self.__get_stat_display(stats, plugin_max_width)
File "/usr/local/lib/python2.7/dist-packages/glances/outputs/glances_curses.py", line 492, in __get_stat_display
ret[p] = stats.get_plugin(p).get_stats_display(args=self.args)
File "/usr/local/lib/python2.7/dist-packages/glances/plugins/glances_plugin.py", line 762, in get_stats_display
'msgdict': self.msg_curse(args),
File "/usr/local/lib/python2.7/dist-packages/glances/plugins/glances_ip.py", line 134, in msg_curse
msg = '{}'.format(self.stats['address'])
KeyError: 'address'

# Fixed code
def msg_curse(self, args=None):
    """Return the dict to display in the curse interface."""
    # Init the return message
    ret = []

    # Only process if stats exist and display plugin enable...
    if not self.stats or self.is_disable():
        return ret

    # Build the string message
    msg = " - "
    ret.append(self.curse_add_line(msg))
    msg = "IP "
    ret.append(self.curse_add_line(msg, "TITLE"))
    if "address" in self.stats:
        msg = "{}".format(self.stats["address"])
        ret.append(self.curse_add_line(msg))
    if "mask_cidr" in self.stats:
        # VPN with no internet access (issue #842)
        msg = "/{}".format(self.stats["mask_cidr"])
        ret.append(self.curse_add_line(msg))
    try:
        msg_pub = "{}".format(self.stats["public_address"])
    except UnicodeEncodeError:
        pass
    else:
        if self.stats["public_address"] is not None:
            msg = " Pub "
            ret.append(self.curse_add_line(msg, "TITLE"))
            ret.append(self.curse_add_line(msg_pub))

    return ret