UnicodeEncodeError: 'charmap' codec can't encode characters in position 337-402: character maps to <undefined>

  The error has been removed but getting the following error (UnicodeEncodeError: 'charmap' codec can't encode characters in position 337-402: character maps to <undefined>).

[notice] To update, run: python.exe -m pip install --upgrade pip  it has been udated already

I have configured:using https://www.jetbrains.com/teamcity/tutorials/python-build-configure-test/

The build is removed from the queue to be prepared for the start
20:22:11 Collecting changes in 1 VCS root
20:22:12 Starting the build on the agent "localhost"
20:22:13 Updating tools for build
20:22:17 Clearing temporary directory: E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\temp\buildTmp
20:22:17 Publishing internal artifacts
20:22:17 Using vcs information from agent file: ccb5862746e6afe1.xml
20:22:17 Checkout directory: E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1
20:22:17 Updating sources: auto checkout (on agent)
20:22:22 Step 1/3: Python
20:22:22   Starting: CMD /c E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\temp\buildTmp\script_1682347942483_1fd414ff-fef6-48d9-8833-f1d75060bdea}5629854864795357728.cmd
20:22:22   in directory: E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1
20:22:22   Create Venv environment
20:22:27   Process exited with code 0
20:22:27   Starting: CMD /c E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\temp\buildTmp\script_1682347942487_c671fd8d-be6f-4a94-b212-d5c772727970}5933546844361249817.cmd
20:22:27   in directory: E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1
20:22:27   Install dependencies in Venv
20:22:28     python -m pip install -r "requirements.txt"
20:22:30     Requirement already satisfied: pytest==6.1.2 in e:\bibhas\mccormick_project\2023\mccormick-project\application security\mitch-devops\sofware\teamcity\buildagentfull\work\ccb5862746e6afe1\.venv\lib\site-packages (from -r requirements.txt (line 1)) (6.1.2)
20:22:30     Requirement already satisfied: flake8==3.8.4 in e:\bibhas\mccormick_project\2023\mccormick-project\application security\mitch-devops\sofware\teamcity\buildagentfull\work\ccb5862746e6afe1\.venv\lib\site-packages (from -r requirements.txt (line 2)) (3.8.4)
20:22:30     Requirement already satisfied: packaging in e:\bibhas\mccormick_project\2023\mccormick-project\application security\mitch-devops\sofware\teamcity\buildagentfull\work\ccb5862746e6afe1\.venv\lib\site-packages (from pytest==6.1.2->-r requirements.txt (line 1)) (23.1)
20:22:30     Requirement already satisfied: toml in e:\bibhas\mccormick_project\2023\mccormick-project\application security\mitch-devops\sofware\teamcity\buildagentfull\work\ccb5862746e6afe1\.venv\lib\site-packages (from pytest==6.1.2->-r requirements.txt (line 1)) (0.10.2)
20:22:30     Requirement already satisfied: colorama in e:\bibhas\mccormick_project\2023\mccormick-project\application security\mitch-devops\sofware\teamcity\buildagentfull\work\ccb5862746e6afe1\.venv\lib\site-packages (from pytest==6.1.2->-r requirements.txt (line 1)) (0.4.6)
20:22:30     Requirement already satisfied: atomicwrites>=1.0 in e:\bibhas\mccormick_project\2023\mccormick-project\application security\mitch-devops\sofware\teamcity\buildagentfull\work\ccb5862746e6afe1\.venv\lib\site-packages (from pytest==6.1.2->-r requirements.txt (line 1)) (1.4.1)
20:22:30     Requirement already satisfied: pluggy<1.0,>=0.12 in e:\bibhas\mccormick_project\2023\mccormick-project\application security\mitch-devops\sofware\teamcity\buildagentfull\work\ccb5862746e6afe1\.venv\lib\site-packages (from pytest==6.1.2->-r requirements.txt (line 1)) (0.13.1)
20:22:30     Requirement already satisfied: attrs>=17.4.0 in e:\bibhas\mccormick_project\2023\mccormick-project\application security\mitch-devops\sofware\teamcity\buildagentfull\work\ccb5862746e6afe1\.venv\lib\site-packages (from pytest==6.1.2->-r requirements.txt (line 1)) (23.1.0)
20:22:30     Requirement already satisfied: py>=1.8.2 in e:\bibhas\mccormick_project\2023\mccormick-project\application security\mitch-devops\sofware\teamcity\buildagentfull\work\ccb5862746e6afe1\.venv\lib\site-packages (from pytest==6.1.2->-r requirements.txt (line 1)) (1.11.0)
20:22:30     Requirement already satisfied: iniconfig in e:\bibhas\mccormick_project\2023\mccormick-project\application security\mitch-devops\sofware\teamcity\buildagentfull\work\ccb5862746e6afe1\.venv\lib\site-packages (from pytest==6.1.2->-r requirements.txt (line 1)) (2.0.0)
20:22:30     Requirement already satisfied: pycodestyle<2.7.0,>=2.6.0a1 in e:\bibhas\mccormick_project\2023\mccormick-project\application security\mitch-devops\sofware\teamcity\buildagentfull\work\ccb5862746e6afe1\.venv\lib\site-packages (from flake8==3.8.4->-r requirements.txt (line 2)) (2.6.0)
20:22:30     Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in e:\bibhas\mccormick_project\2023\mccormick-project\application security\mitch-devops\sofware\teamcity\buildagentfull\work\ccb5862746e6afe1\.venv\lib\site-packages (from flake8==3.8.4->-r requirements.txt (line 2)) (0.6.1)
20:22:30     Requirement already satisfied: pyflakes<2.3.0,>=2.2.0 in e:\bibhas\mccormick_project\2023\mccormick-project\application security\mitch-devops\sofware\teamcity\buildagentfull\work\ccb5862746e6afe1\.venv\lib\site-packages (from flake8==3.8.4->-r requirements.txt (line 2)) (2.2.0)
20:22:30     [notice] A new release of pip is available: 23.0.1 -> 23.1.1
20:22:30     [notice] To update, run: python.exe -m pip install --upgrade pip
20:22:30     Process successfully exited with code 0
20:22:30   Process exited with code 0
20:22:30   Starting: CMD /c E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\temp\buildTmp\script_1682347942489_aeb76657-f588-44d8-a0e7-b73bacd8a757}255851520598128904.cmd
20:22:30   in directory: E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1
20:22:30   Install command tool package
20:22:32   Process exited with code 0
20:22:32   Starting: CMD /c E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\temp\buildTmp\script_1682347942491_d2de5ff3-758d-492e-b581-3127fc9530cb}1829043937811025336.cmd
20:22:32   in directory: E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1
20:22:32   Python run in Venv
20:22:32     python -m flake8 --exit-zero "--output-file=E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\temp\buildTmp\flake_output.txt" --format=flakeReport:::%%(path)s:::%%(row)d:::%%(code)s:%%(text)s
20:24:47     Traceback (most recent call last):
20:24:47       File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
20:24:47         return _run_code(code, main_globals, None,
20:24:47       File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
20:24:47         exec(code, run_globals)
20:24:47       File "E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1\.venv\lib\site-packages\flake8\__main__.py", line 4, in <module>
20:24:47         cli.main()
20:24:47       File "E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1\.venv\lib\site-packages\flake8\main\cli.py", line 22, in main
20:24:47         app.run(argv)
20:24:47       File "E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1\.venv\lib\site-packages\flake8\main\application.py", line 363, in run
20:24:47         self._run(argv)
20:24:47       File "E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1\.venv\lib\site-packages\flake8\main\application.py", line 352, in _run
20:24:47         self.report()
20:24:47       File "E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1\.venv\lib\site-packages\flake8\main\application.py", line 343, in report
20:24:47         self.report_errors()
20:24:47       File "E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1\.venv\lib\site-packages\flake8\main\application.py", line 298, in report_errors
20:24:47         results = self.file_checker_manager.report()
20:24:47       File "E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1\.venv\lib\site-packages\flake8\checker.py", line 261, in report
20:24:47         results_reported += self._handle_results(filename, results)
20:24:47       File "E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1\.venv\lib\site-packages\flake8\checker.py", line 159, in _handle_results
20:24:47         reported_results_count += style_guide.handle_error(
20:24:47       File "E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1\.venv\lib\site-packages\flake8\style_guide.py", line 422, in handle_error
20:24:47         return guide.handle_error(
20:24:47       File "E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1\.venv\lib\site-packages\flake8\style_guide.py", line 577, in handle_error
20:24:47         self.formatter.handle(error)
20:24:47       File "E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1\.venv\lib\site-packages\flake8\formatting\base.py", line 95, in handle
20:24:47         self.write(line, source)
20:24:47       File "E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1\.venv\lib\site-packages\flake8\formatting\base.py", line 206, in write
20:24:47         self._write(line)
20:24:47       File "E:\Bibhas\McCormick_Project\2023\McCormick-Project\Application security\Mitch-DevOps\Sofware\TeamCity\buildAgentFull\work\ccb5862746e6afe1\.venv\lib\site-packages\flake8\formatting\base.py", line 187, in _write
20:24:47         self.output_fd.write(output + self.newline)
20:24:47       File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode
20:24:47         return codecs.charmap_encode(input,self.errors,encoding_table)[0]
20:24:47     UnicodeEncodeError: 'charmap' codec can't encode characters in position 337-402: character maps to <undefined>
20:24:48     Process failed with code 1
20:24:48   Process exited with code 1
20:24:55   Python error: UnicodeEncodeError
20:24:54   Step Python failed

0
1 comment

Hi,

This error does not appear to be related to TeamCity itself, but rather an encoding problem with the python script you are running in this build step. The following thread might be helpful with this issue:

https://stackoverflow.com/questions/27092833/unicodeencodeerror-charmap-codec-cant-encode-characters

 

0

Please sign in to leave a comment.