mckabue commited on
Commit
cab8f0d
·
1 Parent(s): d44f01b

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,5 +1,6 @@
1
  """Shazam Playlist to Youtube Playlist"""
2
 
 
3
  import pandas as pd
4
  from pytube import Search, YouTube
5
  from flask import Flask, request, send_from_directory
@@ -34,8 +35,8 @@ def parse_csv():
34
  return shazamlibrary_df.to_html(index=False, justify="left")
35
  except Exception as e:
36
  return str(e)
37
- # Adding underscore to ignore, otherwise, docker fails with error:
38
- # TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
39
- def _get_youtube_song(title: str, artist: str) -> YouTube | None:
40
  search_result = Search(f'{title} by {artist}')
41
  return search_result.results[0] if search_result.results else None
 
1
  """Shazam Playlist to Youtube Playlist"""
2
 
3
+ from typing import Optional
4
  import pandas as pd
5
  from pytube import Search, YouTube
6
  from flask import Flask, request, send_from_directory
 
35
  return shazamlibrary_df.to_html(index=False, justify="left")
36
  except Exception as e:
37
  return str(e)
38
+
39
+
40
+ def _get_youtube_song(title: str, artist: str) -> Optional[YouTube]:
41
  search_result = Search(f'{title} by {artist}')
42
  return search_result.results[0] if search_result.results else None