Merge pull request #610 from tekii/fix-607

Fix 607
This commit is contained in:
Aldo Cortesi 2015-06-06 11:10:33 +12:00
commit bf7b76a997

View File

@ -284,8 +284,16 @@ def copy_flow(part, scope, flow, master, state):
signals.status_message.send(message="No contents to copy.") signals.status_message.send(message="No contents to copy.")
return return
# pyperclip calls encode('utf-8') on data to be copied without checking.
# if data are already encoded that way UnicodeDecodeError is thrown.
toclip = ""
try: try:
pyperclip.copy(data) toclip = data.decode('utf-8')
except (UnicodeDecodeError):
toclip = data
try:
pyperclip.copy(toclip)
except (RuntimeError, UnicodeDecodeError, AttributeError): except (RuntimeError, UnicodeDecodeError, AttributeError):
def save(k): def save(k):
if k == "y": if k == "y":