The tomcat exploit available on https://www.exploit-db.com/exploits/42966 (Apache Tomcat < 9.0.1 (Beta) / < 8.5.23 / < 8.0.47 / < 7.0.8 – JSP Upload Bypass / Remote Code Execution (2)) CVE-2017-12617 is incompatible with python 3, as it uses print without () and some mixes in use of space and tables.
You can download a fixed version that is compatible with python3 here.