Pyton and uWSGI: Unhandled object from iterator

Please help me understand using uWSGI. Here my Python file:

# cat /var/www/test.py
def application(env, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])
    return ["<h1 style='color:blue'>Test</h1>"]

I launch uWSGI with this command:

# uwsgi --socket 0.0.0.0:8080 --protocol=http --plugin python39 --pythonpath /var/www/ -w test

And got this in console:

*** Starting uWSGI 2.0.19.1 (64bit) on [Sat Sep  4 20:02:16 2021] ***
compiled with version: 10.3.0 on 02 September 2021 21:45:57
os: Linux-5.10.52-gentoo-x86_64 #5 SMP Fri Aug 20 00:32:31 EEST 2021
nodename: virtuala-servilo-2
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /tmp
detected binary path: /usr/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 7854
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
*** RRDtool library available at 0x55ab7e467000 ***
uwsgi socket 0 bound to TCP address 0.0.0.0:8080 fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.9.6 (default, Aug  8 2021, 17:26:32)  [GCC 10.3.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x55ab7e46fed0
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72920 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
added /var/www/ to pythonpath.
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x55ab7e46fed0 pid: 14817 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 14817, cores: 1)

Looks good, but when I try connect to my server I receive this is console:

[ERROR] Unhandled object from iterator: "<h1 style='color:blue'>Test</h1>" (0x7f4fe2a28c30)
[pid: 14817|app: 0|req: 1/1] 85.143.221.42 () {24 vars in 284 bytes} [Sat Sep  4 20:02:21 2021] GET / => generated 0 bytes in 0 msecs (HTTP/1.1 200) 1 headers in 44 bytes (1 switches on core 0)

But if I replace last string in my script to yield None – I don’t receive this error.

Answer

According to the doc, python3 requires return type of bytes.