Repository: mitmproxy/mitmproxy

Issue:
Got an error when using 'P' to copy
```
Traceback (most recent call last):?                                                                                                              
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/libmproxy/console/__init__.py", line 457, in run
    self.loop.run()
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/urwid/main_loop.py", line 278, in run
    self._run()
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/urwid/main_loop.py", line 375, in _run
    self.event_loop.run()
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/urwid/main_loop.py", line 678, in run
    self._loop()
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/urwid/main_loop.py", line 715, in _loop
    self._watch_files[fd]()
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/urwid/raw_display.py", line 392, in <lambda>
    event_loop, callback, self.get_available_raw_input())
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/urwid/raw_display.py", line 492, in parse_input
    callback(processed, processed_codes)
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/urwid/main_loop.py", line 399, in _update
    self.process_input(keys)
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/urwid/main_loop.py", line 499, in process_input
    k = self._topmost_widget.keypress(self.screen_size, k)
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/libmproxy/console/window.py", line 21, in keypress
    k = super(self.__class__, self).keypress(size, k)
File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/urwid/container.py", line 1116, in keypress
    return self.footer.keypress((maxcol,),key)
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/libmproxy/console/statusbar.py", line 123, in keypress
    return self.ab.keypress(*args, **kwargs)
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/libmproxy/console/statusbar.py", line 80, in keypress
    self.prompt_execute(k)
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/libmproxy/console/statusbar.py", line 104, in prompt_execute
    msg = p(txt, *args)
  File "/home/yujie/envwanhuijie/local/lib/python2.7/site-packages/libmproxy/console/common.py", line 289, in copy_flow
    pyperclip.copy(data)
AttributeError: 'bool' object has no attribute 'copy'
```



Discussion:

Resolving patch:
diff --git a/libmproxy/console/common.py b/libmproxy/console/common.py
--- a/libmproxy/console/common.py
+++ b/libmproxy/console/common.py
@@ -287,12 +287,12 @@ def copy_flow(part, scope, flow, master, state):
     try:
         master.add_event(str(len(data)))
         pyperclip.copy(data)
-    except (RuntimeError, UnicodeDecodeError):
+    except (RuntimeError, UnicodeDecodeError, AttributeError):
         def save(k):
             if k == "y":
                 ask_save_path("Save data", data, master, state)
         signals.status_prompt_onekey.send(
-            prompt = "Cannot copy binary data to clipboard. Save as file?",
+            prompt = "Cannot copy data to clipboard. Save as file?",
             keys = (
                 ("yes", "y"),
                 ("no", "n"),


Test patch: