I having a hard time figuring out why this code works in an interactive ipython shell, but it gives a blank clipboard when run in a bash terminal.
from gtk import Clipboard
cb = Clipboard()
text = cb.wait_for_text().split('\n')
text = ''.join(text)
It works if run as ./fix_line_breaks (and of course the shell wrapper I'm using for it)
If I put in a 'print text' at the end, it shows the correct text, it is just not being put into the clipboard from gnome-terminal in X (but it will from the ipython console in gnome-terminal).
However, a paste shows the clipboard to be empty.