UnicodeEncodeError: 'charmap' codec can't encode character 'u03a3' in position 409: character maps to <undefined>
Question:
I am running Python code to pull the issues from JIRA. This code is provided by Atlassian and they are using JiraOne Library.
In the Config.Json file we have the following information.
{
"user": "[email protected]",
"password": "<APITOKEN_HERE>",
"url": "https://nexusfive.atlassian.net"
}
Below is the Python code I am running.
from jiraone import LOGIN, issue_export
import json
file = "config.json"
config = json.load(open(file))
LOGIN(**config)
jql = "project in (AB, BC, IT, IP) order by created DESC"
issue_export(jql=jql)
I am getting below error message and no clue on how to resolve this.
ERROR MESSAGE:
Downloading issue export in CSV format.
<Response [200]> OK ::downloading issues at page: 0 of 9
Traceback (most recent call last):
File "C:UsersUser123DesktopPBI FilesPython Scriptsuntitled10.py", line 12, in <module>
issue_export(jql=jql)
File "C:UsersUser123Anaconda3libsite-packagesjiraonereporting.py", line 2189, in export_issues
file_writer(
File "C:UsersUser123Anaconda3libsite-packagesjiraonereporting.py", line 3223, in file_writer
f.write(content)
File "C:UsersUser123Anaconda3libencodingscp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character 'u03a3' in position 409: character maps to <undefined>
Answers:
To follow the fix provided by Prince Nyeche you have to do the following. Open the file C:UsersUser123Anaconda3libsite-packagesjiraonereporting.py
in your text editor. Go to line 2189. It should look like this:
file_writer(
folder,
file_name,
content=issues.content.decode(encoding, errors=errors),
mark="file",
mode="w+",
)
Add the suggested edit:
content=issues.content.decode('utf-8', errors="replace"),
Save your file. Then try your untitled10.py
code again.
I am running Python code to pull the issues from JIRA. This code is provided by Atlassian and they are using JiraOne Library.
In the Config.Json file we have the following information.
{
"user": "[email protected]",
"password": "<APITOKEN_HERE>",
"url": "https://nexusfive.atlassian.net"
}
Below is the Python code I am running.
from jiraone import LOGIN, issue_export
import json
file = "config.json"
config = json.load(open(file))
LOGIN(**config)
jql = "project in (AB, BC, IT, IP) order by created DESC"
issue_export(jql=jql)
I am getting below error message and no clue on how to resolve this.
ERROR MESSAGE:
Downloading issue export in CSV format.
<Response [200]> OK ::downloading issues at page: 0 of 9
Traceback (most recent call last):
File "C:UsersUser123DesktopPBI FilesPython Scriptsuntitled10.py", line 12, in <module>
issue_export(jql=jql)
File "C:UsersUser123Anaconda3libsite-packagesjiraonereporting.py", line 2189, in export_issues
file_writer(
File "C:UsersUser123Anaconda3libsite-packagesjiraonereporting.py", line 3223, in file_writer
f.write(content)
File "C:UsersUser123Anaconda3libencodingscp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character 'u03a3' in position 409: character maps to <undefined>
To follow the fix provided by Prince Nyeche you have to do the following. Open the file C:UsersUser123Anaconda3libsite-packagesjiraonereporting.py
in your text editor. Go to line 2189. It should look like this:
file_writer(
folder,
file_name,
content=issues.content.decode(encoding, errors=errors),
mark="file",
mode="w+",
)
Add the suggested edit:
content=issues.content.decode('utf-8', errors="replace"),
Save your file. Then try your untitled10.py
code again.