Q:

Why copy doesn't work with dictionary in Python?

copy.copy(tracker.items())

In this code, tracker.items() is a dictionary, and the code in this line reports this error message:
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 96, in copy
    rv = reductor(4)
TypeError: can't pickle dict_items objects

Why does this happen and how to fix it? 

A:

tracker.items() is not a dictionary, it's a dict view of the key/value pairs in tracker. tracker is a dictionary. copy.copy(tracker) will work just fine, and you can always call .items() on the result if you only want to store the view of the key/value pairs.
The error seen is because copy.copy falls back to pickling and unpickling when the type doesn't define copy methods (which dict views do not), but copying the copy-able thing (the dict) is actually very efficient (no pickling needed at all), so you don't need to do try copying the view itself at all:
copy.copy(tracker).items()

or since dicts have a .copy() method, you can avoid the module import and just do:
tracker.copy().items()

