Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearer error messaging for the missing parameters #9

Open
mattikanninen opened this issue Jan 25, 2024 · 0 comments
Open

Clearer error messaging for the missing parameters #9

mattikanninen opened this issue Jan 25, 2024 · 0 comments

Comments

@mattikanninen
Copy link

At the beginning I had troubles to get the script running because I didn't understand first that the POCKETCASTS_USER was not set (I had set the POCKETCASTS_EMAIL per instructions), because the script kept running and the "No Pocket Casts username given! ..." error message got lost in the output flow. The script stopped later during the execution when there was error caused by the missing user id. It would be better to stop the script immediately when the missing user id is noticed.

Here is an example run:

/Users/-/opt/spotify-to-pocketcasts-master/python spotify_to_pocketcasts.py
No Pocket Casts username given! Please set POCKETCASTS_USER or use the --pocketcasts_user option
Logged In!
Got podcast subscriptions from Spotify.
Processing The Hacker Mind
There are 86 episodes!
There are 8 started episodes!
The Hacker Mind: Syncing 8 episodes from Spotify to Pocketcasts
{'Authorization': 'Bearer None', 'content-length': 27}
b'{"term": "The Hacker Mind"}'
Traceback (most recent call last):
  File "/Users/-/opt/spotify-to-pocketcasts-master/spotify_to_pocketcasts.py", line 109, in <module>
    main()
  File "/Users/-/opt/spotify-to-pocketcasts-master/spotify_to_pocketcasts.py", line 91, in main
    uuid = pocketcasts.search_podcasts_and_get_first_uuid(http, token, podcast.title)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/-/opt/spotify-to-pocketcasts-master/pocketcasts.py", line 57, in search_podcasts_and_get_first_uuid
    search_result = search_podcasts(http, token, term)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/-/opt/spotify-to-pocketcasts-master/pocketcasts.py", line 53, in search_podcasts
    return json.loads(response.data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/-/opt/anaconda3/anaconda3/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/-/opt/anaconda3/anaconda3/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/-/opt/anaconda3/anaconda3/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

It would be better to end the script after the second row:

/Users/-/opt/spotify-to-pocketcasts-master/python spotify_to_pocketcasts.py
No Pocket Casts username given! Please set POCKETCASTS_USER or use the --pocketcasts_user option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant