spotDL / spotify-downloader

Download your Spotify playlists and songs along with album art and metadata (from YouTube if a match is found).
https://spotdl.readthedocs.io/en/latest/
MIT License
17.18k stars 1.58k forks source link

ImportError: No module named request with spotdl --playlist #478

Closed RDas01 closed 5 years ago

RDas01 commented 5 years ago

What is the purpose of your issue?

Description

I used to use this progam was back a few years, using 8.x.x or 9.x.x i cant remember, and just installed the newest version, i have tried with master branch and without it. When i try to run "spotdl --playlist " it shows this, i have tried uninstalling/deleting spotdl but still same thing. same thing happens when trying a different playlist. Tried this With and With-out Python at the front, i am using python 3.7 (When using Python3 in place of Python i get.... 'python3' is not recognized as an internal or external command, operable program or batch file. )

Log

```` D:\spotdl-1.1.1\spotdl-1.1.1>spotdl --playlist https://open.spotify.com/user/joe.mcgaffin/playlist/6ymLc2Cd9zMOiwG8MYRog9?si=HEJOqN7ySIez4D7Rb3vXRQ --log-level=DEBUG Traceback (most recent call last): File "C:\Python27\Scripts\spotdl-script.py", line 11, in load_entry_point('spotdl==0.9.3', 'console_scripts', 'spotdl')() File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 480, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 2693, in load_entry_point return ep.load() File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 2324, in load return self.resolve() File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 2330, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "c:\python27\lib\site-packages\spotdl.py", line 5, in from core import metadata File "c:\python27\lib\site-packages\core\metadata.py", line 7, in import urllib.request ImportError: No module named request D:\spotdl-1.1.1\spotdl-1.1.1>python spotdl --playlist https://open.spotify.com/user/contex123/playlist/4aRw3swYaIVp2pkBJxlsgl?si=G0UNT-S6R-CA8A-Af_XoBw --log-level=DEBUG C:\Python27\python.exe: can't find '__main__' module in 'spotdl' D:\spotdl-1.1.1\spotdl-1.1.1> ------------------------------------------- NOTE WITH THIS LINE: C:\Python27\python.exe: can't find '__main__' module in 'spotdl' the" __main__ " part has two underscores ( _ )on each side, its just with github that makes it bold... Same goes for import,name and init, although init appears slanted as only one underscore on each side was used as github text code somehow ```
linusg commented 5 years ago
Code block which will not render Markdown : )
__main__
RDas01 commented 5 years ago

Installed current version, from PyPI, same issue is still occuring, it "cant find main in stopdl, there is no file called main

linusg commented 5 years ago

No, with a fresh install from PyPI that's definitely not happening. Might be your previous attempts to install it manually. Remove it properly and try again.

RDas01 commented 5 years ago

how would i remove it properly ??

RDas01 commented 5 years ago

is there a certain cmd code i need to put in? certain files in other folders? or just delete the spotdl-1.1.1 folder

linusg commented 5 years ago

Depends on what you've done. If you're just running the python file from the repository folder, simply delete the folder. If you did any pip installs, pip uninstall them.

RDas01 commented 5 years ago

I did that, now i keep getting..

``` `D:\spotdl-1.1.1>spotdl --list=chills.txt -f "/chills/" INFO: Checking and removing any duplicate tracks in reading chills.txt INFO: Overriding chills.txt with unique tracks INFO: Preparing to download 365 songs INFO: 1. Crooked Colours - Flow [Official Audio] (http://www.youtube.com/watch?v=2YwRb6-aSrU) 4,609,489 Bytes [100.00%] received. Rate: [3591 KB/s]. ETA: [0 secs] INFO: Converting Crooked Colours - Flow.m4a to mp3 WARNING: Could not find ffmpeg, skipping conversion INFO: Applying metadata INFO: 2. Lana Del Rey - Groupie Love ft. A$AP Rocky (Official Audio) (http://www.youtube.com/watch?v=tBwoRviPvVw) 4,218,879 Bytes [100.00%] received. Rate: [5421 KB/s]. ETA: [0 secs] INFO: Correcting container in "Lana Del Rey - Groupie Love (feat AAP Rocky).m4a" WARNING: Could not find ffmpeg, skipping conversion INFO: Applying metadata Traceback (most recent call last): File "d:\python\lib\site-packages\mutagen\_util.py", line 235, in _openfile fileobj = open(filename, "rb+" if writable else "rb") FileNotFoundError: [Errno 2] No such file or directory: '/chills/Lana Del Rey - Groupie Love (feat AAP Rocky).m4a' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "d:\python\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "d:\python\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\python\Scripts\spotdl.exe\__main__.py", line 9, in File "d:\python\lib\site-packages\spotdl\spotdl.py", line 62, in main match_args() File "d:\python\lib\site-packages\spotdl\spotdl.py", line 38, in match_args list_dl.download_list() File "d:\python\lib\site-packages\spotdl\downloader.py", line 196, in download_list return self._download_list() File "d:\python\lib\site-packages\spotdl\downloader.py", line 205, in _download_list track_dl.download_single() File "d:\python\lib\site-packages\spotdl\downloader.py", line 114, in download_single return self._download_single(songname) File "d:\python\lib\site-packages\spotdl\downloader.py", line 137, in _download_single os.path.join(const.args.folder, output_song), self.meta_tags File "d:\python\lib\site-packages\spotdl\metadata.py", line 33, in embed return embed.as_m4a() File "d:\python\lib\site-packages\spotdl\metadata.py", line 106, in as_m4a audiofile = MP4(music_file) File "d:\python\lib\site-packages\mutagen\_file.py", line 49, in __init__ self.load(*args, **kwargs) File "d:\python\lib\site-packages\mutagen\_util.py", line 139, in wrapper writable, create) as h: File "d:\python\lib\contextlib.py", line 112, in __enter__ return next(self.gen) File "d:\python\lib\site-packages\mutagen\_util.py", line 256, in _openfile raise MutagenError(e) mutagen.MutagenError: [Errno 2] No such file or directory: '/chills/Lana Del Rey - Groupie Love (feat AAP Rocky).m4a' D:\spotdl-1.1.1>` ```

below is the same code but with debug
``` `D:\spotdl-1.1.1>spotdl --list=chills.txt -f "/chills/" --log-level=DEBUG INFO: Checking and removing any duplicate tracks in reading chills.txt INFO: Overriding chills.txt with unique tracks INFO: Preparing to download 364 songs DEBUG: Fetching metadata for given track URL DEBUG: Fetching lyrics DEBUG: {'album': {'album_type': 'album', 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/00FQb4jTyendYWaN8pK0wa'}, 'href': 'https://api.spotify.com/v1/artists/00FQb4jTyendYWaN8pK0wa', 'id': '00FQb4jTyendYWaN8pK0wa', 'name': 'Lana Del Rey', 'type': 'artist', 'uri': 'spotify:artist:00FQb4jTyendYWaN8pK0wa'}], 'external_urls': {'spotify': 'https://open.spotify.com/album/1nP1BEciW2qIlkg4bz97nD'}, 'href': 'https://api.spotify.com/v1/albums/1nP1BEciW2qIlkg4bz97nD', 'id': '1nP1BEciW2qIlkg4bz97nD', 'images': [{'height': 640, 'url': 'https://i.scdn.co/image/705866136850ebd8d6c1c9f7a9002f007c270134', 'width': 640}, {'height': 300, 'url': 'https://i.scdn.co/image/eb02ebcb268a6929bcbfe036a20fab72664142c3', 'width': 300}, {'height': 64, 'url': 'https://i.scdn.co/image/46793b2b8b047f9eaba2c929866e4dad2a8379c4', 'width': 64}], 'name': 'Lust For Life', 'release_date': '2017-07-21', 'release_date_precision': 'day', 'total_tracks': 16, 'type': 'album', 'uri': 'spotify:album:1nP1BEciW2qIlkg4bz97nD'}, 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/00FQb4jTyendYWaN8pK0wa'}, 'href': 'https://api.spotify.com/v1/artists/00FQb4jTyendYWaN8pK0wa', 'id': '00FQb4jTyendYWaN8pK0wa', 'name': 'Lana Del Rey', 'type': 'artist', 'uri': 'spotify:artist:00FQb4jTyendYWaN8pK0wa'}, {'external_urls': {'spotify': 'https://open.spotify.com/artist/13ubrt8QOOCPljQ2FL1Kca'}, 'href': 'https://api.spotify.com/v1/artists/13ubrt8QOOCPljQ2FL1Kca', 'id': '13ubrt8QOOCPljQ2FL1Kca', 'name': 'A$AP Rocky', 'type': 'artist', 'uri': 'spotify:artist:13ubrt8QOOCPljQ2FL1Kca'}], 'copyright': '© 2017 Lana Del Rey, under exclusive licence to Polydor Ltd. ' '(UK). Under exclusive licence to Interscope Records in the USA', 'disc_number': 1, 'duration': 264.037, 'explicit': True, 'external_ids': {'isrc': 'GBUM71703296'}, 'external_urls': {'spotify': 'https://open.spotify.com/track/3tWa5qmAJ2OsHV6KxNZBxc'}, 'genre': 'Pop', 'href': 'https://api.spotify.com/v1/tracks/3tWa5qmAJ2OsHV6KxNZBxc', 'id': '3tWa5qmAJ2OsHV6KxNZBxc', 'is_local': False, 'lyrics': "You're in the bar, playing guitar\n" "I'm trying not to let the crowd next to me\n" "It's so hard sometimes with the star\n" 'When you have to share him with everybody\n' "You're in the club, living it up\n" "I'm trying not to let the crowd notice me\n" "It's so sweet, swingin' to the beat\n" "When I know that you're doing it all for me\n" '\n' 'And every time you look up\n' "I know what you're thinking of\n" "I know what you're thinking of\n" '\n' 'You want my\n' 'Groupie love\n' 'Groupie love\n' 'Groupie love\n' '\n' 'Time after time, writing my lines\n' 'Having my baby there next to me\n' "It's so sweet, pouring you a drink\n" 'And pretending that nothing means anything\n' 'This is my life, you by my side\n' 'Key lime and perfume and festivals\n' 'Taking our dreams, turning them to things\n' "It's like magic, babe, isn't life wonderful?\n" '\n' 'And every time we hook up\n' "I know what you're thinking of\n" "I know what you're thinking of\n" '\n' 'You want my\n' 'Groupie love\n' 'Groupie love\n' 'Groupie love\n' '\n' 'Front row, every show like a hype man (hmm)\n' 'Sing along word for word while she my bae (yeah)\n' "Side stage, fans screamin' causin' migraines\n" "Yamborghini-high, but she ain't on my grade (hmm, hmm)\n" 'God dang, got a nigga acting irate (hmm, hmm)\n' 'My babe, my babe, stay on my brain (yeah)\n' 'My babe, made me sing to a fire escape\n' 'City girl, but she grew up in the tri-state\n' "She ain't got no time for no groupie love (hmm)\n" "We don't pay no minds to the thug with a... (hmm)\n" 'Love girls, you and I, so who do we trust?\n' "You and I 'til the day we die (You and I 'til the day we die)\n" '\n' 'Groupie love\n' 'Groupie love\n' 'Groupie love\n' 'You are my babe\n' 'Groupie love\n' 'Groupie love\n' 'Groupie love\n' 'Groupie love', 'name': 'Groupie Love (feat. A$AP Rocky)', 'popularity': 9, 'preview_url': None, 'publisher': 'Universal Music Group', 'release_date': '2017-07-21', 'total_tracks': 16, 'track_number': 7, 'type': 'track', 'uri': 'spotify:track:3tWa5qmAJ2OsHV6KxNZBxc', 'year': '2017'} DEBUG: Opening URL: https://www.youtube.com/results?sp=EgIQAQ%253D%253D&q=Lana%20Del%20Rey%20-%20Groupie%20Love%20%28feat.%20A%24AP%20Rocky%29%20lyrics INFO: 1. Lana Del Rey - Groupie Love ft. A$AP Rocky (Official Audio) (http://www.youtube.com/watch?v=tBwoRviPvVw) DEBUG: Refining songname from "Lana Del Rey - Groupie Love ft. A$AP Rocky (Official Audio)" to "Lana Del Rey - Groupie Love (feat AAP Rocky)" DEBUG: Cleaning any temp files and checking if "Lana Del Rey - Groupie Love (feat AAP Rocky)" already exists DEBUG: Downloading from URL: https://r6---sn-uxanug5-ntqr.googlevideo.com/videoplayback?dur=265.589&source=youtube&lmt=1540462417060977&requiressl=yes&txp=5533432&clen=4218879&key=yt6&gir=yes&itag=140&expire=1547561392&fvip=6&mv=m&mt=1547539687&ms=au%2Conr&ei=UJU9XLq8KJqjz7sP2sKAgA0&ip=2001%3A8003%3A2610%3A6400%3A10f7%3Abf9e%3Ad5e5%3A276f&pl=39&keepalive=yes&mn=sn-uxanug5-ntqr%2Csn-a5meknlz&mm=31%2C26&id=o-AILoc4m2cn_HjilIRHgnufVK0NsJRVflGjPw-NaZm4Ss&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&mime=audio%2Fmp4&initcwndbps=1352500&c=WEB&ipbits=0&signature=2C471777FAB206848521B392A455EAF68A40776B.3B33EED970813B4D4ADB9C48905D01F5590C6FFA&ratebypass=yes DEBUG: Saving to: /chills/Lana Del Rey - Groupie Love (feat AAP Rocky).m4a 4,218,879 Bytes [100.00%] received. Rate: [5401 KB/s]. ETA: [0 secs] INFO: Converting Lana Del Rey - Groupie Love (feat AAP Rocky).m4a to mp3 DEBUG: ['ffmpeg', '-y', '-i', '/chills/Lana Del Rey - Groupie Love (feat AAP Rocky).m4a', '-codec:v', 'copy', '-codec:a', 'libmp3lame', '-ar', '44100', '-b:a', '192k', '-vn', '/chills/Lana Del Rey - Groupie Love (feat AAP Rocky).mp3'] WARNING: Could not find ffmpeg, skipping conversion INFO: Applying metadata DEBUG: Removing downloaded song from tracks file DEBUG: Removing downloaded song from tracks file DEBUG: Fetching metadata for given track URL DEBUG: Fetching lyrics DEBUG: {'album': {'album_type': 'album', 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7dlqUnjoF2U2DkNDMhcgG4'}, 'href': 'https://api.spotify.com/v1/artists/7dlqUnjoF2U2DkNDMhcgG4', 'id': '7dlqUnjoF2U2DkNDMhcgG4', 'name': 'Hilltop Hoods', 'type': 'artist', 'uri': 'spotify:artist:7dlqUnjoF2U2DkNDMhcgG4'}], 'external_urls': {'spotify': 'https://open.spotify.com/album/4ijUWjOHZ5VnUADcOsL1vS'}, 'href': 'https://api.spotify.com/v1/albums/4ijUWjOHZ5VnUADcOsL1vS', 'id': '4ijUWjOHZ5VnUADcOsL1vS', 'images': [{'height': 640, 'url': 'https://i.scdn.co/image/60ef7128e2f10c2a7238f6842bcccfaa840167f6', 'width': 640}, {'height': 300, 'url': 'https://i.scdn.co/image/3502f231d7c3fe9fbc18ad41ed022c6eeff51116', 'width': 300}, {'height': 64, 'url': 'https://i.scdn.co/image/8f7fe7295fc491da3fa18bded6c8e4558eb77599', 'width': 64}], 'name': 'Drinking From The Sun, Walking Under Stars Restrung', 'release_date': '2016-02-19', 'release_date_precision': 'day', 'total_tracks': 19, 'type': 'album', 'uri': 'spotify:album:4ijUWjOHZ5VnUADcOsL1vS'}, 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7dlqUnjoF2U2DkNDMhcgG4'}, 'href': 'https://api.spotify.com/v1/artists/7dlqUnjoF2U2DkNDMhcgG4', 'id': '7dlqUnjoF2U2DkNDMhcgG4', 'name': 'Hilltop Hoods', 'type': 'artist', 'uri': 'spotify:artist:7dlqUnjoF2U2DkNDMhcgG4'}, {'external_urls': {'spotify': 'https://open.spotify.com/artist/0ukgrNYk51TkMQr0f2Br4Q'}, 'href': 'https://api.spotify.com/v1/artists/0ukgrNYk51TkMQr0f2Br4Q', 'id': '0ukgrNYk51TkMQr0f2Br4Q', 'name': 'Maverick Sabre', 'type': 'artist', 'uri': 'spotify:artist:0ukgrNYk51TkMQr0f2Br4Q'}], 'copyright': '© 2015 Hilltop Hoods Pty Ltd, under exclusive license to ' 'Universal Music Australia Pty Ltd.', 'disc_number': 1, 'duration': 265.04, 'explicit': True, 'external_ids': {'isrc': 'AUHT01503047'}, 'external_urls': {'spotify': 'https://open.spotify.com/track/7oM9RuAbgbGGhJvdhBbxHJ'}, 'genre': 'Australian Hip Hop', 'href': 'https://api.spotify.com/v1/tracks/7oM9RuAbgbGGhJvdhBbxHJ', 'id': '7oM9RuAbgbGGhJvdhBbxHJ', 'is_local': False, 'lyrics': None, 'name': "Won't Let You Down Restrung", 'popularity': 40, 'preview_url': None, 'publisher': 'Universal Music Australia Pty. Ltd.', 'release_date': '2016-02-19', 'total_tracks': 19, 'track_number': 7, 'type': 'track', 'uri': 'spotify:track:7oM9RuAbgbGGhJvdhBbxHJ', 'year': '2016'} DEBUG: Opening URL: https://www.youtube.com/results?sp=EgIQAQ%253D%253D&q=Hilltop%20Hoods%20-%20Won%27t%20Let%20You%20Down%20Restrung%20lyrics INFO: 2. Hilltop Hoods - Won't Let You Down feat. Maverick Sabre (http://www.youtube.com/watch?v=X6G2fzPTwOA) DEBUG: Refining songname from "Hilltop Hoods - Won't Let You Down feat. Maverick Sabre" to "Hilltop Hoods - Won't Let You Down Restrung" DEBUG: Cleaning any temp files and checking if "Hilltop Hoods - Won't Let You Down Restrung" already exists DEBUG: Downloading from URL: https://r2---sn-uxanug5-ntqr.googlevideo.com/videoplayback?mime=audio%2Fmp4&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&txp=5533432&initcwndbps=1352500&ipbits=0&fvip=2&expire=1547561397&ip=2001%3A8003%3A2610%3A6400%3A10f7%3Abf9e%3Ad5e5%3A276f&keepalive=yes&lmt=1539895660077815&itag=140&requiressl=yes&id=o-AFkdX_x-l8kaGrbDmdrLABuVhpzslLiyBk_vsJiZJlRN&source=youtube&dur=265.729&key=yt6&mm=31%2C26&mn=sn-uxanug5-ntqr%2Csn-a5mlrnek&mt=1547539687&pl=39&mv=m&ei=VZU9XM3pIPjRz7sP6cCj2A4&ms=au%2Conr&clen=4221090&beids=9466588&gir=yes&c=WEB&signature=AA968E42BD0C5C8C28A153FBCFA2EE05AC184D04.317772152DE968FC388F919177F519D045D6E298&ratebypass=yes DEBUG: Saving to: /chills/Hilltop Hoods - Won't Let You Down Restrung.m4a 4,221,090 Bytes [100.00%] received. Rate: [5570 KB/s]. ETA: [0 secs] INFO: Correcting container in "Hilltop Hoods - Won't Let You Down Restrung.m4a" DEBUG: Input file and output file are going will be same during encoding, will append ".temp" to input file just before starting encoding to avoid conflict DEBUG: ['ffmpeg', '-y', '-i', "/chills/Hilltop Hoods - Won't Let You Down Restrung.m4a.temp", '-acodec', 'copy', '-b:a', '192k', '-vn', "/chills/Hilltop Hoods - Won't Let You Down Restrung.m4a"] WARNING: Could not find ffmpeg, skipping conversion INFO: Applying metadata Traceback (most recent call last): File "d:\python\lib\site-packages\mutagen\_util.py", line 235, in _openfile fileobj = open(filename, "rb+" if writable else "rb") FileNotFoundError: [Errno 2] No such file or directory: "/chills/Hilltop Hoods - Won't Let You Down Restrung.m4a" During handling of the above exception, another exception occurred: Traceback (most recent call last): File "d:\python\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "d:\python\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\python\Scripts\spotdl.exe\__main__.py", line 9, in File "d:\python\lib\site-packages\spotdl\spotdl.py", line 62, in main match_args() File "d:\python\lib\site-packages\spotdl\spotdl.py", line 38, in match_args list_dl.download_list() File "d:\python\lib\site-packages\spotdl\downloader.py", line 196, in download_list return self._download_list() File "d:\python\lib\site-packages\spotdl\downloader.py", line 205, in _download_list track_dl.download_single() File "d:\python\lib\site-packages\spotdl\downloader.py", line 114, in download_single return self._download_single(songname) File "d:\python\lib\site-packages\spotdl\downloader.py", line 137, in _download_single os.path.join(const.args.folder, output_song), self.meta_tags File "d:\python\lib\site-packages\spotdl\metadata.py", line 33, in embed return embed.as_m4a() File "d:\python\lib\site-packages\spotdl\metadata.py", line 106, in as_m4a audiofile = MP4(music_file) File "d:\python\lib\site-packages\mutagen\_file.py", line 49, in __init__ self.load(*args, **kwargs) File "d:\python\lib\site-packages\mutagen\_util.py", line 139, in wrapper writable, create) as h: File "d:\python\lib\contextlib.py", line 112, in __enter__ return next(self.gen) File "d:\python\lib\site-packages\mutagen\_util.py", line 256, in _openfile raise MutagenError(e) mutagen.MutagenError: [Errno 2] No such file or directory: "/chills/Hilltop Hoods - Won't Let You Down Restrung.m4a" D:\spotdl-1.1.1>` ```
ritiek commented 5 years ago

@RDas01 Seems like you're hitting #470 which should be fixed on master branch. You can either install from master branch or wait for v1.1.2 to be released on PyPI (which might take a few days).