我怎样才能修复这个mitmproxys SyntaxError?

时间:2013-08-13 11:58:47

标签: python linux amazon-ec2 mitmproxy

我正在亚马逊AWS EC2服务器上安装mitmproxy,但我已经将mitmproxy写入终端,我得到以下异常。通过谷歌,我还没有发现任何事情:(我希望有人可以帮助我。(也许我已经发布了一些信息,如果有的话我很抱歉:'[)

  Traceback (most recent call last) :
  File "/usr/bin/mitmproxy", line 19, in <module>
    from libmproxy import proxy, console, cmdline, version
  File "/usr/lib/python2.6/site-packages/libmproxy/proxy.py", line 20, in <module>
    import utils, flow, version, platform, controller, app
  File "usr/lib/python2.6/site-packages/libmproxy/flow.py", line 789
    cookie_parameters = {key.strip().lower() :value.strip() for key,sep,value in pairs[1:]}

  SyntaxError: invalid syntax

cat /proc/version向我提供以下信息

Linux version 3.4.48-45.46.amzn1.i686 (mockbuild@gobi-build-31004) (gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC) ) #1 SMP Wed Jun 12 02:04:37 UTC 2013

python -V写入终端我获得Python 2.7.3

pip list

 argparse (1.2.1)
 BeautifulSoup (3.2.1)
 Flask (0.10.1)
 itsdangerous (0.23)
 Jinja2 (2.7.1)
 lxml (3.2.3)
 MarkupSafe (0.18)
 mechanize (0.2.5)
 mitmproxy (0.9.1)
 netlib (0.9.1)
 PIL (1.1.7)
 pip (1.4.1)
 protobuf (2.5.0)
 PyAMF (0.6.1)
 pyasn1 (0.1.7)
 pyOpenSSL (0.13)
 Scrapy (0.18.0)
 setuptools (0.6c11)
 urwid (1.1.1)
 virtualenv (1.10.1)
 Werkzeug (0.9.3)
 wsgiref (0.1.2)

pip-2.6 list

 argparse (1.2.1)
 aws-cfn-bootstrap (1.3)
 backports.ssl-match-hostname (3.2a3)
 certifi (0.0.8)
 chardet (2.0.1)
 Cheetah (2.4.1)
 cloud-init (0.5.15)
 configobj (4.6.0)
 distribute (0.6.10)
 Flask (0.10.1)
 iniparse (0.3.1)
 itsdangerous (0.23)
 Jinja2 (2.7.1)
 lockfile (0.8)
 lxml (3.2.3)
 M2Crypto (0.20.2)
 Markdown (2.0.1)
 MarkupSafe (0.18)
 mitmproxy (0.9.1)
 netlib (0.9.1)
 ordereddict (1.1)
 PIL (1.1.6)
 pip (1.4.1)
 protobuf (2.5.0)
 pyasn1 (0.1.7)
 pycurl (7.19.0)
 Pygments (1.4)
 pygpgme (0.1)
 pyOpenSSL (0.13)
 pystache (0.5.2)
 python-daemon (1.5.2)
 PyYAML (3.10)
 requests (1.1.0)
 Exception:
 Traceback (most recent call last):
   File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/basecommand.py",      line 134, in main
     status = self.run(options, args)
   File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/commands/list.py",      line 80, in run
     self.run_listing(options)
   File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/commands/list.py",      line 127, in run_listing
     self.output_package_listing(installed_packages)
   File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/commands/list.py",      line 136, in output_package_listing
     if dist_is_editable(dist):
   File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/util.py", line 347,      in dist_is_editable
     req = FrozenRequirement.from_dist(dist, [])
   File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/__init__.py", line      194, in from_dist
     assert len(specs) == 1 and specs[0][0] == '=='
 AssertionError

 Storing complete log in /home/ec2-user/.pip/pip.log

pip-2.7 list

 argparse (1.2.1)
 BeautifulSoup (3.2.1)
 Flask (0.10.1)
 itsdangerous (0.23)
 Jinja2 (2.7.1)
 lxml (3.2.3)
 MarkupSafe (0.18)
 mechanize (0.2.5)
 mitmproxy (0.9.1)
 netlib (0.9.1)
 PIL (1.1.7)
 pip (1.4.1)
 protobuf (2.5.0)
 PyAMF (0.6.1)
 pyasn1 (0.1.7)
 pyOpenSSL (0.13)
 Scrapy (0.18.0)
 setuptools (0.6c11)
 urwid (1.1.1)
 virtualenv (1.10.1)
 Werkzeug (0.9.3)
 wsgiref (0.1.2)

最好的, SnowN

1 个答案:

答案 0 :(得分:1)

File "usr/lib/python2.6/site-packages/libmproxy/flow.py", line 789

Python 2.6没有dict理解;您将需要重写它以使用dict对的可迭代调用(key, value)构造函数。