[Python] Invalid argument when saving pickle file [duplicate]

Discussão em 'Python' iniciado por Stack, Agosto 29, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to save my machine learning model into a pickle file:

    rf_pickle_path=os.path.join(os.getcwd(),"penguin_ml\random_forest_penguin.pickle")
    rf_pickle = open(rf_pickle_path, "wb")
    pickle.dump(rfc, rf_pickle)
    rf_pickle.close()


    But I got the error below:

    File "c:\Python_Sync\penguin_ml\penguins_ml.py", line 39, in <module>
    rf_pickle = open(rf_pickle_path, "wb")
    OSError: [Errno 22] Invalid argument: 'C:\\Python_Sync\\penguin_ml\random_forest_penguin.pickle'


    Not sure why? Thanks for helping.

    Continue reading...

Compartilhe esta Página