TheNathanSpace/iDeemYouWorthy

Required Dependencies

Closed this issue · 20 comments

When executing main.py from the iDeemYouWorthy folder, I get an error saying:

File "C:\Users\User-PC\Downloads\iDeemYouWorthy.v1.9\ideemyouworthy\main.py", line 7, in

from deemix.utils.localpaths import getConfigFolder

ModuleNotFoundError: No module named 'deemix'

I have installed Deemix-GUI and I have the Pyweb version + the latest version of Python.

I'm not very good at distributing Python programs for other people to run, sorry about that! As far as I can tell, here are the packages you'll need to install:

deemix==2.0.8
pywin32==300
tinytag==1.5.0
youtube-dl==2020.12.29
youtube-search==1.1.1

You can install these with this command for each package: pip install -Iv package_name==package_version

Please continue to let me know if you need help with anything! Thanks :)

Hey thanks for the reply man, I have installed all the packages and I have gone further, but now I get a different error when I run main.py:

Traceback (most recent call last):
File "C:\Users\User-PC\Downloads\iDeemYouWorthy.v1.9\ideemyouworthy\main.py", line 8, in
from deemix.app.settings import Settings
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\deemix\app_init_.py", line 3, in
from deemix.app.queuemanager import QueueManager
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\deemix\app\queuemanager.py", line 1, in
from deemix.app.downloadjob import DownloadJob
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\deemix\app\downloadjob.py", line 19, in
from deemix.app.track import Track, AlbumDoesntExists
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\deemix\app\track.py", line 6, in
from deezer.gw import APIError as gwAPIError, LyricsStatus
ImportError: cannot import name 'APIError' from 'deezer.gw' (C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\deezer\gw.py)

Any help is appreciated man!

Aw geez, we'll see if updating the deemix dependency will fix it without breaking my program 🤞

Run this: pip install deemix -U

And then try it again!

I've also added a new release (1.10) because I forgot to do that earlier, if you were using 1.9 you should switch to 1.10!

I have tried the pip install deemix -U & have switched to 1.10, but still no luck! Same error as before ImportError: cannot import name 'APIError' from 'deezer.gw' (C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\deezer\gw.py). If you have any fix, let me know. Your tools sounds really promising! Does the tool work for you btw or am I the only one with this problem?

Okay, I think I have a good solution for you. The problem is that I haven't been keeping the dependencies up-to-date on my computer while developing this, so when you install them fresh you're getting the wrong versions that I haven't accounted for.

To fix this, you should update your requirements.txt file to look like this:

# iDeemYouWorthy requirements.txt 
deemix==2.0.8
deezer-py==0.0.15
pywin32>=300
tinytag>=1.5.0
youtube-dl>=2020.12.29
youtube-search>=1.1.1

(I've changed the 1.10 download so it should be updated as well)

Then, in the directory where your requirements.txt is located, run this command: pip install -r requirements.txt.

This will fix all of your installed dependencies to be the correct version. Now try running main.py! Let me know how it goes.

That worked man, thanks! However, now I have a new problem. I have done what you said for acquiring the ClientID and all, have added it to the Json file, but only the ClientID gives an error for some reason:

INFO:iDeemYouWorthy:User account info loaded
INFO:iDeemYouWorthy:Attempting to authorize with Spotify
Traceback (most recent call last):
File "C:\Users\User-PC\Downloads\iDeemYouWorthy-1.10\ideemyouworthy\main.py", line 58, in
account_manager.login_spotify()
File "C:\Users\User-PC\Downloads\iDeemYouWorthy-1.10\ideemyouworthy\accountmanager.py", line 36, in login_spotify
auth_manager = SpotifyOAuth(client_id = self.account_info_dict["SPOTIFY_CLIENT_ID"],
KeyError: 'SPOTIFY_CLIENT_ID'

I have checked the formatting of the Json file with the tool you mentioned and it said the formatting was correct. Any help appreciated, once again!

Hm, that's a weird one... I don't know why that would happen. Here's a guess.

This is what account_info.json originally looked like:

{
    "SPOTIFY_USERNAME": "",
    "SPOTIFY_CLIENT_ID": "",
    "SPOTIFY_CLIENT_SECRET": "",
    "DEEZER_ARL": ""
}

This is what that file is supposed to look like with example tokens:

{
    "SPOTIFY_USERNAME": "sf08ug804h302gn02200g42",
    "SPOTIFY_CLIENT_ID": "gi8h492gneisowo3ggs",
    "SPOTIFY_CLIENT_SECRET": "fgn8932hfiewnoi32g42",
    "DEEZER_ARL": "g4j02g9jeiodsjgo4ww"
}

Did you put your client ID where the letters/numbers are, or where the SPOTIFY_CLIENT_ID is? It should be inside the empty quotation marks, where the letters and numbers are in the above example.

If this doesn't help, could you replace the tokens you put in there with just keyboard mashing (so I can take a look) and share your whole account_info.json here?

Hi Nathan, you were right, I had stupidly did that wrong. But now I got a new error hahahahah:

File "C:\Users\User-PC\Downloads\iDeemYouWorthy-1.10\ideemyouworthy\main.py", line 63, in
youtube_manager = YoutubeManager(logger, account_manager.spotify_manager, music_directory, youtube_tag_dict)
File "C:\Users\User-PC\Downloads\iDeemYouWorthy-1.10\ideemyouworthy\youtubemanager.py", line 50, in init
self.master_track_file.touch()
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 1305, in touch
fd = self._raw_open(flags, mode)
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 1117, in _raw_open
return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\User-PC\Downloads\iDeemYouWorthy-1.10\cache\track_master_list.json'

Isn't it weird how it adds an extra \ in the pathway, maybe that's the problem? Also it refers to the parent folder, not the sub folder with all the files. But I also don't see a 'cache' folder, only a __pycache__ folder, can that be the problem?

I'm sorry for the trouble Nathan, but I feel we are getting really close! If you are not interested in helping further, I understand!

Aw geez, I see what's wrong here. It's trying to create a file in a subdirectory that doesn't yet exist. I didn't pick that up in my testing because of the way I have it set up on my system. Oops!

I've just updated the .zip download for 1.10, so you can download that, unzip it, and replace the files in your current installation directory (or however you want to switch to the new version—the important part is that the ideemyouworthy folder in the .zip replaces the one in your current iDeemYouWorthy-1.10 folder!). That should fix it!

Let me say, it's really exciting to actually have someone trying out this thing I made, so I'm perfectly happy to help you! :)

Thanks man, great to hear!

This worked, but now up to the next bug! I have to enter the URL of Spotify I was redirected to, but the URL (https://accounts.spotify.com/authorize?client_id=418b8b060c09473b9c08b0c5ebf233f2&response_type=code&redirect_uri=https%3A%2F%2Fexample.com&scope=playlist-read-private+playlist-read-collaborative) is invalid, giving me this error on the website: INVALID_CLIENT: Invalid redirect URI and this error in the Powershell when I enter that URL:

File "C:\Users\User-PC\Downloads\iDeemYouWorthy-1.10\ideemyouworthy\main.py", line 69, in
new_playlists = playlist_manager.get_new_user_playlists()
File "C:\Users\User-PC\Downloads\iDeemYouWorthy-1.10\ideemyouworthy\playlistmanager.py", line 55, in get_new_user_playlists
playlists = self.spotify_manager.user_playlists(spotify_username)
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\spotipy\client.py", line 757, in user_playlists
return self._get(
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\spotipy\client.py", line 291, in _get
return self._internal_call("GET", url, payload, kwargs)
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\spotipy\client.py", line 221, in _internal_call
headers = self._auth_headers()
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\spotipy\client.py", line 212, in _auth_headers
token = self.auth_manager.get_access_token(as_dict=False)
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\spotipy\oauth2.py", line 543, in get_access_token
raise SpotifyOauthError(
spotipy.oauth2.SpotifyOauthError: error: invalid_request, error_description: code must be supplied

Again, any help appreciated!

It looks like your Spotify app isn't set up quite right and it's missing a redirect URL. (I didn't mention that in the instructions so my bad). Go to https://developer.spotify.com/dashboard/applications, open your application, and click Edit Settings. Like in the below image, add http://example.com in Redirect URIs. That should fix your problem.

image

Yes! That also worked man, however it wasn't as easy as I thought. The first times it didn't work, so I made a new app, added a couple variations of http://example.com and now it works. HOWEVER, I think we have a final and last problem!

File "C:\Users\User-PC\Downloads\iDeemYouWorthy-1.10\ideemyouworthy\main.py", line 81, in
playlist_manager.create_playlist_files(new_playlists)
File "C:\Users\User-PC\Downloads\iDeemYouWorthy-1.10\ideemyouworthy\playlistmanager.py", line 75, in create_playlist_files
file_path.touch()
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 1305, in touch
fd = self._raw_open(flags, mode)
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 1117, in _raw_open
return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\User-PC\Downloads\iDeemYouWorthy-1.10\playlists\[NAME OF PLAYLIST].json'

Almost the same as a previous issue I had. Hopefully the last roadblock :P

I think I know what's wrong. Does the playlist name have any of these characters in it? \/:*?"<>| These can't be used in filepaths.

That problem is fixed in the updated version of 1.10!

You hit the hammer on the nail again! That was it indeed. However, I now run into a new problem.

Traceback (most recent call last):
File "C:\Users\User-PC\Downloads\iDeemYouWorthy-1.10\ideemyouworthy\main.py", line 114, in
deezer_id = spotify_helper.get_trackid_spotify(deezer_object, split_uri[2], False, None)
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\deemix\app\spotifyhelper.py", line 143, in get_trackid_spotify
raise spotifyFeaturesNotEnabled
deemix.app.spotifyhelper.spotifyFeaturesNotEnabled

That's a weird one! It looks like one of the dependencies needs Spotify API access that I didn't give it, so I've fixed that in the updated 1.10 download!.

A lot of these bugs you're encountering are because I seem to have a lot of environmental stuff left over from development. When you install it fresh you don't have those. My bad!

Hi Nathan, unbelievable, but (almost) everything works! Only 100 of my 3000 songs were not successfully downloaded because the YouTube downloader tool did not work, but the rest worked flawlessly and I have download almost all my music! Thank you for all your help and hopefully is your tool now 100% working for everyone :)

That's fantastic! :) I'm glad to hear.

If you want to describe what's wrong with the YouTube downloader (and pass along any error messages), I'd be happy to look into that. If you want to upload your most recent .log, found in the logs directory (might want to remove playlist names from the log file text), that might point me in the right direction (my logging is sub-par, though, so we'll see...).

If you don't want to take the time I understand—that was a lot of back-and-forth the past 5 days ;)

Sorry for all the trouble, but yeah, it's definitely in working order now! Thanks for being my beta tester!

Absolutely no problem man, see log file for the error(s?). Thanks!
2021-07-31 16꞉27꞉17.574860.log

Awesome, that gives a lot of info. It looks like that youtube-dl error is fixed in a later versions of youtube-dl. I changed the requirements.txt file to use a later version; if you want to manually install a later version there are instructions in the StackOverflow question I linked. Or you can download the latest requirements.txt (or full 1.10 download) and run the command pip install -r requirements.txt.

If this error made the program crash early, and your playlists aren't formed properly, you can delete the playlists folder, and on the program's next run it'll reform them (the downloaded songs are still saved so it'll just take a minute).