Internal Server Error - 'ascii' codec can't encode characters in position 0-32: ordinal not in range(128)

Questions about WAPT Server / Requests and help related to the WAPT server
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
Floflobel
Messages: 135
Registration: Oct 15, 2015 - 5:32 p.m.

November 19, 2020 - 11:45 AM

Good morning,

On a newly installed client machine, I get an error when I try to access http://localhost:8088/.

Code: Select all

Internal Server Error
The server encountered an unexpected internal server error
(generated by waitress)
I noticed in the logs that there was an ASCII problem concerning the field: "host_info['system_manufacturer']":

Code: Select all

2020-11-19 10:27:03,398 [waitress       ] ERROR Exception while serving /
Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\lib\site-packages\waitress\channel.py", line 349, in service
    task.service()
  File "C:\Program Files (x86)\wapt\lib\site-packages\waitress\task.py", line 169, in service
    self.execute()
  File "C:\Program Files (x86)\wapt\lib\site-packages\waitress\task.py", line 439, in execute
    app_iter = self.channel.server.application(environ, start_response)
  File "C:\Program Files (x86)\wapt\lib\site-packages\flask\app.py", line 2463, in __call__
    return self.wsgi_app(environ, start_response)
  File "C:\Program Files (x86)\wapt\lib\site-packages\flask\app.py", line 2449, in wsgi_app
    response = self.handle_exception(e)
  File "C:\Program Files (x86)\wapt\lib\site-packages\flask\app.py", line 1866, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Program Files (x86)\wapt\lib\site-packages\flask\app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Program Files (x86)\wapt\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Program Files (x86)\wapt\lib\site-packages\flask\app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Program Files (x86)\wapt\lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Program Files (x86)\wapt\lib\site-packages\flask\app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 117, in decorated
    return f(*args, **kwargs)
  File "C:\Program Files (x86)\wapt\waptservice\service.py", line 1443, in index
    return render_wapt_template('index.html',**data)
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 1307, in render_wapt_template
    return render_template(template_name_or_list, **context)
  File "C:\Program Files (x86)\wapt\lib\site-packages\flask\templating.py", line 140, in render_template
    ctx.app,
  File "C:\Program Files (x86)\wapt\lib\site-packages\flask\templating.py", line 120, in _render
    rv = template.render(context)
  File "C:\Program Files (x86)\wapt\lib\site-packages\jinja2\environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "C:\Program Files (x86)\wapt\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Program Files (x86)\wapt\waptservice\templates\index.html", line 1, in top-level template code
    {% extends "layout.html" %}
  File "C:\Program Files (x86)\wapt\waptservice\templates\layout.html", line 53, in top-level template code
    {% block content %}
  File "C:\Program Files (x86)\wapt\waptservice\templates\index.html", line 58, in block "content"
    <li>{{ _("System manufacturer : {0}").format(host_info['system_manufacturer']) }}</li>
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-32: ordinal not in range(128)
Indeed, when I go to the console I see an ASCII problem in the "Model" and "Manufacturer" fields of my computer:
Screenshot_20201119_110716.png
Screenshot_20201119_110716.png (13.06 KB) Viewed 8547 times
(I have intentionally removed the job title and IP address)

I have approximately 28 workstations out of 2000 that have this problem.
  • WAPT Server version: 1.8.2
    WAPT Agent version: 1.8.2.7267
    WAPT Setup version: 1.8.2.7267
    WAPT Deploy version: 1.8.2.7267
Do you have any information about this problem and where it might be coming from?

Thanks in advance.
Floflobel
Messages: 135
Registration: Oct 15, 2015 - 5:32 p.m.

January 20, 2021 - 2:21 PM

I'm just bumping this thread.
Floflobel
Messages: 135
Registration: Oct 15, 2015 - 5:32 p.m.

February 3, 2021 - 4:33 PM

I'd like to bring this topic up again.
User avatar
dcardon
WAPT Expert
Messages: 1929
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

February 5, 2021 - 10:22

As the message indicates, there are special characters in the manufacturer name (returned by dmidecode or wmi). You can patch the line in question by adding an ensure_unicode around the line host_info['system_manufacturer'].
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Floflobel
Messages: 135
Registration: Oct 15, 2015 - 5:32 p.m.

February 8, 2021 - 5:55 PM

Thank you for your feedback.

Do I need to patch and recompile the WAPT console? Or is there another way to do it?
User avatar
dcardon
WAPT Expert
Messages: 1929
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

February 11, 2021 - 1:44 PM

The next version of WAPT will be in Python 3 and should handle this scenario better. Otherwise, yes, a patch will be necessary.
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked