> with open("albums.txt", "r") as albums:
> mylist = []
> for line in albums:
> # data row should consist of (artist, album, year, song)
> artist_field, album_field, year_field, song_field = tuple(line.strip('\n').split('\t'))
> year_field = int(year_field)
> mylist.append((artist_field, album_field, year_field, song_field))
> song_list = []
> for i in [5, 10, 26, 28, 41]:
> song_list.append(mylist[i])
>
> del mylist
print(song_list)
I try to delete mylist but I see an error only in the console and not when it runs. It seems like it is deleted, and I don't see any problem with the program. Maybe I don't understand the error.
Traceback (most recent call last): File "C:\Users\G\AppData\Roaming\JetBrains\IntelliJIdea2022.2\plugins\python\helpers\pydev_pydevd_bundle\pydevd_thrift.py", line 241, in frame_vars_to_struct v = frame_f_locals[k] KeyError: 'mylist' Unexpected error, recovered safely.