Skip to content

Commit

Permalink
Added some error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
victordlp8 committed Oct 28, 2022
1 parent e74f263 commit f0aaa81
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions spotifyVisualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ def main():
DATE_FORMAT = 'Week %W of %Y'
paths = Paths()

fileList = [f for f in os.listdir(
paths.data) if os.path.isfile(os.path.join(paths.data, f))]
if os.path.exists(paths.data):
fileList = [f for f in os.listdir(
paths.data) if os.path.isfile(os.path.join(paths.data, f))]
if len(fileList) == 0:
print('[ERROR] Unable to find StreamingHistory files.')
exit()
else:
print('[ERROR] Please make sure the directory \'data\' exists.')
exit()

songs = []
for file in fileList:
Expand Down

0 comments on commit f0aaa81

Please sign in to comment.