Use mitmproxy with PyInstaller

Hello everyone!

I’m trying to use mitmproxy in a Python 3 app that I’m building, but after packaging with PyInstaller, I get this error when running the app on the Mac:

ValueError: dataPath: mitmproxy/addons/onboardingapp/templates does not exist.

I’m I missing something in the PyInstaller spec?

I only found this post from 2016 but I don’t understand it ;(

Thank you for the help and the awesome OSS project!

The problem only happens when importing:

In order to use:
m =

I was able to package the app with this workaround:

  1. Importing the mitmproxy like this:
import mitmproxy
import mitmproxy.options
import mitmproxy.proxy
  1. Importing configparser:

import configparser

  1. After packaging copying the directory mitmproxy into ./dist/