question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

import ctype error when used with --scripts SCRIPT option from mitmdump

See original GitHub issue
Steps to reproduce the problem:
  1. install binary release
  2. run mitmdump -s test.py (with import ctypes)

Output:

  Addon error: Traceback (most recent call last):
  File "site-packages/PyInstaller/loader/pyiboot01_bootstrap.py", line 149, in __init__
  File "ctypes/__init__.py", line 347, in __init__
OSError: command_path: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "mitmproxy/addonmanager.py", line 67, in safecall
  File "mitmproxy/addons/script.py", line 76, in tick
  File "mitmproxy/addonmanager.py", line 177, in register
  File "mitmproxy/command.py", line 134, in collect_commands
  File "ctypes/__init__.py", line 417, in __getattr__
  File "site-packages/PyInstaller/loader/pyiboot01_bootstrap.py", line 151, in __init__
PyInstallerImportError: Failed to load dynlib/dll 'command_path'. Most probably this dynlib/dll was not found when the application was frozen.
System information

UBUNTU 16.04

Mitmproxy: 3.0.0.dev1136 (commit 15f525e) binary Python: 3.5.2 OpenSSL: OpenSSL 1.1.0g 2 Nov 2017 Platform: Linux-4.13.0-32-generic-x86_64-with-debian-stretch-sid

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
idiotsavantcommented, Mar 31, 2018

Homebrew has an --enable-bar option to force building from source rather than using a “bottled” binary. Any chance of supporting that in future?

Instead, on MacOS High Sierra:

brew uninstall mitmproxy pip3 install mitmproxy

I didn’t need sudo for pip3 because Python 2 and 3 are installed through Homebrew.

BeautifulSoup module is now found again!

0reactions
crifancommented, Nov 12, 2019

Same error here

macOS, install by brew

brew install mitmproxy

then run

mitmdump -p 8081 -s Save1.py

error: in script Save1.py: No module named 'yaml'

Reason:

brew installed mitmproxy contained a self version python, located in

/usr/local/Cellar/mitmproxy/4.0.4_3/libexec/bin/python

when using mitmdump -s some_python_script.py, while some_python_script.py contain some thirdparty libs, such as here’s yaml

it can NOT found it, so report error: No module named 'yaml'

Solution:

NOT using brew install mitmproxy: brew uninstall mitmproxy

but change to your system’s Python:

pyenv global 3.8.0

's pip:

pip3 install mitmproxy

Note: can NOT use (system’s) python2(2.7.5) to install mitmproxy, it will fail:

pip install mitmproxy
...
ERROR: matplotlib 1.3.1 requires nose, which is not installed.
Installing collected packages: configargparse, six, editorconfig, jsbeautifier, argh, pathtools, watchdog, MarkupSafe, Jinja2, Werkzeug, click, itsdangerous, Flask, pyperclip, singledispatch, certifi, backports-abc, tornado, pyasn1, pycparser, cffi, enum34, ipaddress, idna, cryptography, pyOpenSSL, backports.ssl-match-hostname, brotlipy, passlib, blinker, lxml, hyperframe, pyparsing, construct, requests, html2text, urwid, typing, cssutils, Pillow, hpack, h2, mitmproxy
    Running setup.py install for configargparse ... done
  Found existing installation: six 1.4.1
ERROR: Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error while using external Python module in mitmproxy project
I want to use some external module in my custom addon. For instance I want to use module lxml to parse some traffic...
Read more >
Add proxy for python - sono naturale
Edit the HTTP entry in the Proxy Learn how to use mitmproxy framework to build HTTP ... Python Scripting is configured using the...
Read more >
Privacy International's data interception environment
You can now start mitmproxy using " mitmproxy_start.sh " on the desktop ... If you are getting errors in the logfile for mitmproxy...
Read more >
ChangeLog - ftp
Fix an error in courier-imap's installation script that results in creation ... Add an option to highlight using middle click instead of pressing...
Read more >
mimtproxy running python script: "XX Module not imported"
If you want to use Python packages that are not included in mitmproxy's own installation, you need to install mitmproxy via pip or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found