Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to paste from clipboard on Heroku iPython?

Basically what I'm trying to do is get the %paste function to work when I run iPython on the heroku one-off dyno using the django-extension app: heroku run python manage.py shell_plus

The problem is when I try to paste into the console, I get the following error:

ERROR: Getting text from the clipboard on this platform requires Tkinter.

I've looked into how to install Tkinter and it looks like there's no pypi package for it, nor is there any promising leads besides having root access (which is not possible with the heroku one-off dynos). How do I get Tkinter installed on my heroku app?

Alternatively, is there another way to get the %paste function working with iPython on Heroku?

like image 622
fangsterr Avatar asked Aug 28 '14 17:08

fangsterr


1 Answers

Reposting as an answer:

%paste probably won't work on Heroku, because it will look at the server clipboard, not your local clipboard.

You can instead use %cpaste. This lets you paste in text using your regular terminal mechanisms (without auto-indent getting in the way, as it would if you tried to paste into IPython directly). Paste the text you need, and then enter a line with just -- to finish.

like image 180
Thomas K Avatar answered Nov 09 '22 08:11

Thomas K