# Buggy code
def Display(self, item):
    if item not in self.data:
        return

    if not self.Search:
        self.Immediate.hide()
        self.Position.hide()
        self.Country.hide()
        self.Queue.hide()
        self.Immediate.hide()
        self.ImmediateLabel.hide()
        self.PositionLabel.hide()
        self.QueueLabel.hide()
        self.ImmediateLabel.hide()
        self.DownloadItem.hide()
        self.DownloadAll.hide()
    else:
        self.Immediate.show()
        self.Position.show()
        self.Country.show()
        self.Queue.show()
        self.Immediate.show()
        self.ImmediateLabel.show()
        self.PositionLabel.show()
        self.QueueLabel.show()
        self.ImmediateLabel.show()
        self.DownloadItem.show()
        self.DownloadAll.show()

    self.current = item
    data = self.data[self.current]
    More = False

    if len(list(self.data.keys())) > 1:
        More = True

    self.Next.set_sensitive(More)
    self.Previous.set_sensitive(More)
    self.DownloadAll.set_sensitive(More)

    self.Username.set_text(data["user"])
    self.Filename.set_text(data["filename"])
    self.Directory.set_text(data["directory"])
    self.Size.set_text(str(data["size"]))
    self.Speed.set_text(data["speed"])
    self.Position.set_text(str(data["position"]))

    if data["bitrate"] not in ("", None):
        self.Bitrate.set_text(data["bitrate"])
    else:
        self.Bitrate.set_text("")

    self.Length.set_text(data["length"])
    self.Queue.set_text(data["queue"])
    self.Immediate.set_text(str(data["immediate"] == "Y"))

    country = data["country"]
    if country not in ("", None):
        self.Country.set_markup(_("<b>Country Code:</b> ") + country)
        self.Country.show()
    else:
        self.Country.set_text("")
        self.Country.hide()


# Traceback (SystemError)
Thu 07:58 Nicotine+ supports a country code blocker. This requires a (GPL'ed) library called GeoIP. You can find it here: C library:       https://github.com/maxmind/geoip-api-c Python
bindings: https://github.com/maxmind/geoip-api-python (the python bindings require the C library)
Traceback (most recent call last):
File "/usr/local/bin/nicotine", line 255, in <module>
run()
File "/usr/local/bin/nicotine", line 231, in run
app = frame.MainApp(data_dir, config, plugins, trayicon, hidden, bindip, port)
File "/usr/local/lib/python3.7/site-packages/pynicotine/gtkgui/frame.py", line 3595, in __init__
self.frame = NicotineFrame(data_dir, config, plugins, trayicon, start_hidden, bindip, port)
File "/usr/local/lib/python3.7/site-packages/pynicotine/gtkgui/frame.py", line 273, in __init__
config
File "/usr/local/lib/python3.7/site-packages/pynicotine/pynicotine.py", line 130, in __init__
self.shares = Shares(self)
File "/usr/local/lib/python3.7/site-packages/pynicotine/shares.py", line 75, in __init__
self.CompressShares("normal")
File "/usr/local/lib/python3.7/site-packages/pynicotine/shares.py", line 201, in CompressShares
m.makeNetworkMessage(nozlib=0, rebuild=True)
File "/usr/local/lib/python3.7/site-packages/pynicotine/slskmessages.py", line 1709, in makeNetworkMessage
msg = msg + self.packObject(len(list(self.list.keys())))
File "/usr/local/lib/python3.7/_collections_abc.py", line 720, in __iter__
yield from self._mapping
File "/usr/local/lib/python3.7/shelve.py", line 95, in __iter__
for k in self.dict.keys():
SystemError: Negative size passed to PyBytes_FromStringAndSize

# Fixed code
def Display(self, item):
    if item not in self.data:
        return

    if not self.Search:
        self.Immediate.hide()
        self.Position.hide()
        self.Country.hide()
        self.Queue.hide()
        self.Immediate.hide()
        self.ImmediateLabel.hide()
        self.PositionLabel.hide()
        self.QueueLabel.hide()
        self.ImmediateLabel.hide()
        self.DownloadItem.hide()
        self.DownloadAll.hide()
    else:
        self.Immediate.show()
        self.Position.show()
        self.Country.show()
        self.Queue.show()
        self.Immediate.show()
        self.ImmediateLabel.show()
        self.PositionLabel.show()
        self.QueueLabel.show()
        self.ImmediateLabel.show()
        self.DownloadItem.show()
        self.DownloadAll.show()

    self.current = item
    data = self.data[self.current]
    More = False

    if len(self.data) > 1:
        More = True

    self.Next.set_sensitive(More)
    self.Previous.set_sensitive(More)
    self.DownloadAll.set_sensitive(More)

    self.Username.set_text(data["user"])
    self.Filename.set_text(data["filename"])
    self.Directory.set_text(data["directory"])
    self.Size.set_text(str(data["size"]))
    self.Speed.set_text(data["speed"])
    self.Position.set_text(str(data["position"]))

    if data["bitrate"] not in ("", None):
        self.Bitrate.set_text(data["bitrate"])
    else:
        self.Bitrate.set_text("")

    self.Length.set_text(data["length"])
    self.Queue.set_text(data["queue"])
    self.Immediate.set_text(str(data["immediate"] == "Y"))

    country = data["country"]
    if country not in ("", None):
        self.Country.set_markup(_("<b>Country Code:</b> ") + country)
        self.Country.show()
    else:
        self.Country.set_text("")
        self.Country.hide()