Search code examples
azuremachine-learningazure-web-app-serviceazure-machine-learning-service

Error 0085 while executing python script in Azure Web service but not in ML Experiment


My workflow is running perfect on Experimentation, but after deployed to web service, I receive this error while post.

Python Code:

# -*- coding: utf-8 -*-

#import sys
import pickle
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
from sklearn import tree 

def azureml_main(dataframe1 = None, dataframe2 = None):
    print('input dataframe1 ',dataframe1)
    decision_tree_pkl_predictive_maint = r'.\Script Bundle\decision_tree_pkl_predictive_maint.pkl'

    #sys.path.insert(0,".\Script Bundle")
    #model = pickle.load(open(".\Script Bundle\decision_tree_pkl_predictive_maint.pkl", 'rb'))

    modle_file = open(decision_tree_pkl_predictive_maint,"rb")
    model = pickle.load(modle_file)

    #return the mode of prediciton
    result = model.predict(dataframe1)
    print(result)
    result_df = pd.DataFrame({'prediction_class':result})
    return result_df,

ERROR:

Execute Python Script RRS : Error 0085: The following error occurred during script evaluation, please view the output log for more information: ---------- Start of error message from Python interpreter ---------- Caught exception while executing function: Traceback (most recent call last): File "\server\InvokePy.py", line 120, in executeScript outframe = mod.azureml_main(*inframes) File "\temp-1036260731852293620.py", line 46, in azureml_main modle_file = open(decision_tree_pkl_predictive_maint,"rb") FileNotFoundError: [Errno 2] No such file or directory: '.\Script Bundle\decision_tree_pkl_predictive_maint.pkl' ---------- End of error message from Python interpreter ----------

Please, Advice.


Solution

  • The issue has to do with your file path. Ensure that you have included the correct path.