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

Fix IndexError in spotifycli.py for Python 3.13 compatibility #89

Merged
merged 1 commit into from
Dec 28, 2024
Merged

Fix IndexError in spotifycli.py for Python 3.13 compatibility #89

merged 1 commit into from
Dec 28, 2024

Conversation

panpeacemaker
Copy link
Contributor

PR fixes an IndexError that occurs with Python 3.13 due to accessing tuple indices that may not exist.
The fix adds a length check before accessing the tuple to ensure compatibility with Python 3.13.
Tested on Arch Linux with Python 3.13.

pwittchen
pwittchen previously approved these changes Dec 24, 2024
@pwittchen
Copy link
Owner

Thanks for the PR!

@pwittchen
Copy link
Owner

pwittchen commented Dec 24, 2024

CI Build failed due to invalid format:

spotifycli/spotifycli.py:112:80: E501 line too long (81 > 79 characters)
        arg_type = 'store' if len(argument) > 2 and argument[2] else 'store_true'

Can you please fix the code formatting and keep it up to smaller number of characters in a single line?

@pwittchen
Copy link
Owner

pwittchen commented Dec 24, 2024

There are still errors in code formatting on CI (I copied them below from CI logs in GH Actions).

You check check this format locally by running command make checkformat

spotifycli/spotifycli.py:108:1: E302 expected 2 blank lines, found 1
def add_arguments():
^
    Separate top-level function and class definitions with two blank
    lines.

    Method definitions inside a class are separated by a single blank
    line.

    Extra blank lines may be used (sparingly) to separate groups of
    related functions.  Blank lines may be omitted between a bunch of
    related one-liners (e.g. a set of dummy implementations).

    Use blank lines in functions, sparingly, to indicate logical
    sections.

    Okay: def a():\n    pass\n\n\ndef b():\n    pass
    Okay: def a():\n    pass\n\n\nasync def b():\n    pass
    Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
    Okay: default = 1\nfoo = 1
    Okay: classify = 1\nfoo = 1

    E[30](https://github.com/pwittchen/spotify-cli-linux/pull/89/checks#step:5:31)1: class Foo:\n    b = 0\n    def bar():\n        pass
    E302: def a():\n    pass\n\ndef b(n):\n    pass
    E302: def a():\n    pass\n\nasync def b(n):\n    pass
    E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
    E303: def a():\n\n\n\n    pass
    E304: @decorator\n\ndef a():\n    pass
    E305: def a():\n    pass\na()
    E306: def a():\n    def b():\n        pass\n    def c():\n        pass

@pwittchen
Copy link
Owner

Thanks for the fix. Can you please squash all your commits into one?

@pwittchen pwittchen merged commit 3eb80bc into pwittchen:develop Dec 28, 2024
2 checks passed
@panpeacemaker panpeacemaker deleted the fix-indexerror-python-3.13 branch December 30, 2024 03:16
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

Successfully merging this pull request may close these issues.

2 participants