Azure ML API .ilearner file download wrong decoding RRS feed

  • Question

  • I would like to ask for solutions for the problem that occurs when I follow the instructions on establishing API described on this webpage https://docs.microsoft.com/en-us/azure/machine-learning/studio/retrain-models-programmatically I run the Python 3.5 script and the following error occurs just after downloading the .ilearner file

      File "<ipython-input-1-157aac1e9b7a>", line 162, in <module>

      File "<ipython-input-1-157aac1e9b7a>", line 157, in invokeBatchExecutionService

      File "<ipython-input-1-157aac1e9b7a>", line 51, in processResults
        saveBlobToFile(url3, "The results for " + outputName)

      File "<ipython-input-1-157aac1e9b7a>", line 28, in saveBlobToFile
        f.write(response.read().decode("utf8", 'ignore'))

      File "D:\XXXXXX\lib\encodings\cp1252.py", line 19, in encode
        return codecs.charmap_encode(input,self.errors,encoding_table)[0

    " UnicodeEncodeError: 'charmap' codec can't encode character '\u053e' in position 1463: character maps to <undefined>"

    I didn't change anything in the code apart from required parts. My model has two outputs : .ilearner file that I would like to retrain and .csv file with output of evalutaion of additional data. Could you instruct me how to decode properly .ilearner ?
    Wednesday, January 31, 2018 4:45 PM

All replies

  • Could you try posting this question on Stack Overflow? We might get some more answers in that tech community 


    Feel free to share the link on here once it is posted so we can try to help there too :) 

    Thursday, February 1, 2018 2:35 AM
  • Within function definition saveBlobToFile, replace:

    with open(output_file, "w+") as f:


    with open(output_file, "w+", encoding="utf-8") as f:

    That's all!


    • Proposed as answer by Ariel Cedola Wednesday, December 19, 2018 2:50 PM
    Wednesday, December 19, 2018 2:50 PM