Importing code files with unicode using listings

I've written a program in python, about 2500 lines in total, that I wish to include segments from into my report. Normally I use listings to do that but in this case, the .py files include many unicode characters which are necessary for the understanding of the files.

These characters, e.g. ⇒, cause these errors in latex

! Package inputenc Error: Unicode char �\lst@FillFixed@ (U+5B4) (inputenc) not set up for use with LaTeX.
! Package inputenc Error: Keyboard character used is undefined (inputenc) in inputencoding utf8'.


MWE:

\documentclass[a4paper, 11pt]{report}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel} % English language/hyphenation
\usepackage{xcolor}
\usepackage{listings}
\usepackage[T1]{fontenc}

\begin{document}
\chapter{Fists Chapter}
Some text
\lstinputlisting[language=Python, inputencoding=utf8, extendedchars=true]{code.py}
\end{document}


.py file

def Code(self):

• It's not easy. check for example tex.stackexchange.com/questions/378600/… (I have a literate set for Spanish language, that's quite easy --- but doing that for a lot of chars is difficult). – Rmano Nov 16 '18 at 11:29
• For full Unicode support you should probably be using XeLaTeX or LuaLaTeX instead of pdfLaTeX. If I remove \usepackage[utf8]{inputenc} and \usepackage[T1]{fontenc}, switch to \usepackage{fontspec}\setmainfont{Linux Libertine O} and compile with LuaLaTeX the code prints as expected. Oh, and if you are a Python person anyway, you may want to try minted instead of listings`: tex.stackexchange.com/q/300719/35864 – moewe Nov 16 '18 at 11:31