You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
I'm unable to properly retrieve and parse the data to a new file from the UltiPro API. I get a UnicodeEncodeError when I attempt to do so.
Describe the Solution You Would Like
The method open() in write_file() in helpers.py is missing an additional argument specifying the encoding should be utf-8
Orignial
def write_file(report_stream, path):
"""Writes a stream to a file"""
f = open(path, "w")
f.write(report_stream)
f.close()
Updated
def write_file(report_stream, path):
"""Writes a stream to a file"""
f = open(path, "w", encoding='utf-8')
f.write(report_stream)
f.close()
I have verified on my local machine that making this change and setting this additional parameter fixes this issue and allows me to properly write a new file with the desired data.
Describe Alternatives You've Considered
I've attempted to override or monkey patch this method, but am having difficulty getting it to work.
Additional Context
I need this library for an AWS Lambda function so an update to the library would be necessary for functionality.
The text was updated successfully, but these errors were encountered:
Use Case
I'm unable to properly retrieve and parse the data to a new file from the UltiPro API. I get a UnicodeEncodeError when I attempt to do so.
Describe the Solution You Would Like
The method open() in write_file() in helpers.py is missing an additional argument specifying the encoding should be utf-8
Orignial
def write_file(report_stream, path):
"""Writes a stream to a file"""
f = open(path, "w")
f.write(report_stream)
f.close()
Updated
def write_file(report_stream, path):
"""Writes a stream to a file"""
f = open(path, "w", encoding='utf-8')
f.write(report_stream)
f.close()
I have verified on my local machine that making this change and setting this additional parameter fixes this issue and allows me to properly write a new file with the desired data.
Describe Alternatives You've Considered
I've attempted to override or monkey patch this method, but am having difficulty getting it to work.
Additional Context
I need this library for an AWS Lambda function so an update to the library would be necessary for functionality.
The text was updated successfully, but these errors were encountered: