[Python] Python3 pickle: Expected type 'SupportsWrite[bytes]', got 'BinaryIO' instead

Discussão em 'Python' iniciado por Stack, Abril 20, 2025.

  1. Stack

    Stack Membro Participativo

    A simple program in PyCharm 2024.2.3.(Community Edition)

    import pickle

    fruits = ['apples', 'oranges', 'banana']

    with open('myData.pkl', 'wb') as f:
    pickle.dump(fruits, f)


    PyCharm gives me a warning:


    Expected type 'SupportsWrite[bytes]', got 'BinaryIO' instead
    ​

    The program runs correctly, but how do I get rid of this warning?

    Python tutorials say that this simple usage of pickle should work.

    Continue reading...

Compartilhe esta Página