Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I had pastie working for the longest time on Ubuntu 11.04, working great, I love the little bugger :) I still have it working on my laptop (same system).

Recently I ran upgrade on all packages in my Ubuntu 11 system. Now pastie doesn't work, this is the error I get:

Traceback (most recent call last):
  File "/usr/bin/pastie", line 96, in <module>
    clipboard_protector = protector.ClipboardProtector()
  File "/usr/lib/pymodules/python2.7/pastielib/", line 72, in __init__
  File "/usr/lib/pymodules/python2.7/pastielib/", line 138, in recover_history
    history_tree = tree.parse(input_file)
  File "/usr/lib/python2.7/xml/etree/", line 1177, in parse
    tree.parse(source, parser)
  File "/usr/lib/python2.7/xml/etree/", line 653, in parse
  File "/usr/lib/python2.7/xml/etree/", line 1624, in feed
  File "/usr/lib/python2.7/xml/etree/", line 1488, in _raiseerror
    raise err
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 2, column 380

Anyone know what to do to get this thing to work again or what the heck all those error's mean? I'm not a python guy. I tried apt-get purge pastie and re-install but no go.

share|improve this question
I know this doesn't solve your problem, but here's an explanation of what's going on when you see that message. – SirCharlo Sep 7 '12 at 20:00
Actually that might just be it! EUREKA!! Thanks, something tell's me it's in the XML config file, let me look into that first and see. You see, it did help, it help's to know how python think's ha ha – jfreak53 Sep 7 '12 at 20:04
Keep me posted ;) – SirCharlo Sep 7 '12 at 20:05
GOT IT!!! After going through the file that was being called I found out that the clipboard history file is located in ~/.local/share/pastie. Come to find out it was choking on something I copied in the past and was just sitting in that history file. So I deleted the file and WALLA!! It work's! Thanks – jfreak53 Sep 7 '12 at 20:15
up vote 3 down vote accepted

For those looking in the future for this same problem as Pastie doesn't help any at all! :)

The answer was hinted on by SirCharlo. By looking through the code I found that Pastie uses a clipboard history file in XML, the code for this is in the main Pastie file and

Running a find in my home directory I found that Pastie stores this history file in ~/.local/share/pastie, it's called clipboard_history.

Basically something that was copied in the past had a character that Python didn't like or wasn't escaped right by the software code. So it was choking on that line of XML in the history file.

So just go to that directory and erase the file completely and restart pastie, works like a charm. If your using an older version of Pastie the file is located at ~/.clipboard_history

share|improve this answer
Good for you! Now if you want, you can also mark your answer as accepted. Until next time! ;) – SirCharlo Sep 7 '12 at 21:15
I'd like to, but it doesn't let me for 2 more days ha ha – jfreak53 Sep 7 '12 at 21:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.