Robin | 3 Mar 17:40
Picon

paste frustrations

Hi,

I have some data that was generated as a list of tuples which i
thought it would be easy to copy and paste between sessions.

However I have come completely unstuck and am having a lot of trouble
pasting it into both Ipython and the normal python prompt.

The data I would like to paste are at
http://www.robince.net/robince/data.txt

Initially there was a leading space (how the list was displayed by
default in ipython) which I removed since I was getting indentation
errors. (although I thought it was a principle that it should be
possible to copy and paste objects like lists without such manual
intervention).

I can paste different sections OK, but when I try and paste the whole
lot I get errors like this:
------------------------------------------------------------
   File "<ipython console>", line 33
     (5.898507409(5.898507409(5.898507409(5.898507409(5.898507409(5.898507409193459628247,
11.799637880699656, 0.51856981446673678)]

                                                            ^
SyntaxError: invalid syntax

This is driving me absolutely batty - I have quite a few sets like
this I was planning to paste in - I'd appreciate any pointers on how
to load this text data into an ipython variable.
(Continue reading)

Laurent Dufréchou | 3 Mar 18:16
Picon

Re: paste frustrations

Hi robin,
Just tried your .txt file under windows, it works well.
I've added space at beginning of line 1 and some other lines, it works too.
Under windows doinc ctrl+c and with the mouse doing the paste in the
terminal.
Are you under another os?
Have you tried with %cpaste? (just in case)

Laurent

> -----Message d'origine-----
> De : ipython-user-bounces <at> scipy.org [mailto:ipython-user-
> bounces <at> scipy.org] De la part de Robin
> Envoyé : mardi 3 mars 2009 17:40
> À : ipython-user <at> scipy.org
> Objet : [IPython-user] paste frustrations
> 
> Hi,
> 
> I have some data that was generated as a list of tuples which i
> thought it would be easy to copy and paste between sessions.
> 
> However I have come completely unstuck and am having a lot of trouble
> pasting it into both Ipython and the normal python prompt.
> 
> The data I would like to paste are at
> http://www.robince.net/robince/data.txt
> 
> Initially there was a leading space (how the list was displayed by
> default in ipython) which I removed since I was getting indentation
(Continue reading)

Ville M. Vainio | 3 Mar 18:16
Picon
Gravatar

Re: paste frustrations

On Tue, Mar 3, 2009 at 6:40 PM, Robin <robince <at> gmail.com> wrote:

> This is driving me absolutely batty - I have quite a few sets like
> this I was planning to paste in - I'd appreciate any pointers on how
> to load this text data into an ipython variable.

Use %cpaste

I.e. execute %cpaste, prepend "var =", paste, teminate with --, press
enter. Worked ok on my linux at least

--

-- 
Ville M. Vainio
http://tinyurl.com/vainio
Alan G Isaac | 3 Mar 18:27
Picon
Favicon
Gravatar

Re: paste frustrations

On 3/3/2009 11:40 AM Robin apparently wrote:
> http://www.robince.net/robince/data.txt

At the standard Python interpreter prompt,
copy and paste works fine:
Windows XP, Python 2.5.4 or 3.0.

Alan Isaac
Robin | 3 Mar 18:28
Picon

Re: paste frustrations

Whoops - forgot to reply-all... I think this is one of the only lists
I use that doesn't set the Reply-To header in the convenient
fashion...

On Tue, Mar 3, 2009 at 5:16 PM, Ville M. Vainio <vivainio <at> gmail.com> wrote:
> On Tue, Mar 3, 2009 at 6:40 PM, Robin <robince <at> gmail.com> wrote:
>
>> This is driving me absolutely batty - I have quite a few sets like
>> this I was planning to paste in - I'd appreciate any pointers on how
>> to load this text data into an ipython variable.
>
> Use %cpaste
>
> I.e. execute %cpaste, prepend "var =", paste, teminate with --, press
> enter. Worked ok on my linux at least

Even with cpaste I am having trouble - although it helps to see what
was pasted before executing it.
I am using Ipython 0.9.1 on os x 10.5.6 (intel):

It looks like the paste is getting corrupted even before I press
return on the cpaste, notice that some lines seem to have repeated
sections.

I thought it might be my terminal (iterm), but the same clipboard
contents paste fine into vim or cat << EOF. It is just Ipython that
seems to corrupt it. Could it be a problem with readline? I'm at a bit
of a loss...

Thanks
(Continue reading)

Robin | 3 Mar 18:28
Picon

Re: paste frustrations

On Tue, Mar 3, 2009 at 5:27 PM, Alan G Isaac <aisaac <at> american.edu> wrote:
> On 3/3/2009 11:40 AM Robin apparently wrote:
>> http://www.robince.net/robince/data.txt
>
> At the standard Python interpreter prompt,
> copy and paste works fine:
> Windows XP, Python 2.5.4 or 3.0.
>
> Alan Isaac

I should add I get the same corruption in the normal python prompt so
perhaps it is a readline issue...

Robin
Hao Xiong | 3 Mar 19:35
Picon

Re: paste frustrations

Hi Robin,

Your text file works fine on my Linux box so it may be something with
your system.

A workaround is to make the text file true Python program by pre-pending
"tmp = " and do "%run data.txt" This will bring "tmp" into IPython's
namespace.

Hao

Robin wrote:
> On Tue, Mar 3, 2009 at 5:27 PM, Alan G Isaac <aisaac <at> american.edu> wrote:
>   
>> On 3/3/2009 11:40 AM Robin apparently wrote:
>>     
>>> http://www.robince.net/robince/data.txt
>>>       
>> At the standard Python interpreter prompt,
>> copy and paste works fine:
>> Windows XP, Python 2.5.4 or 3.0.
>>
>> Alan Isaac
>>     
>
> I should add I get the same corruption in the normal python prompt so
> perhaps it is a readline issue...
>
> Robin
> _______________________________________________
(Continue reading)

Ludwig Schwardt | 4 Mar 09:21
Picon
Gravatar

Re: paste frustrations

Hi,

As someone who had something to do with readline support for ipython on Mac OS X, I cringe every time I hear that word... ("readline", that is :-))

I share your paste frustration. For the past few months I have had numerous mispastes into ipython, usually when pasting large blocks of code, or code with complicated indenting and line continuations. I first suspected my editor, but never really investigated the problem until now.

The text you posted at http://www.robince.net/robince/data.txt is a real poison pill... When I start up ipython 0.9.1 on Mac OS 10.5.6 and paste this text at the terminal prompt, ipython crashes with the message:

s_push: parser stack overflow
---------------------------------------------------------------------------
MemoryError

The IPython crash report is available on request.

I tried pasting the text into System Python 2.5.1, which resulted in corrupted text (duplicated text snippets) and a resulting syntax error, but no crash. System Python on Mac OS X uses editline, which is a replacement for readline, so the problem does not seem to be readline itself. I confirmed this by switching off readline in ipython ("readline 0" in ipythonrc), which results in the same crash as before.

The problem therefore seems to be Python itself on Mac OS X...

Regards,
Ludwig

_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
Ville M. Vainio | 4 Mar 09:28
Picon
Gravatar

Re: paste frustrations

On Wed, Mar 4, 2009 at 10:21 AM, Ludwig Schwardt
<ludwig.schwardt <at> gmail.com> wrote:

> The text you posted at http://www.robince.net/robince/data.txt is a real
> poison pill... When I start up ipython 0.9.1 on Mac OS 10.5.6 and paste this
> text at the terminal prompt, ipython crashes with the message:
> s_push: parser stack overflow

Can you try pasting it from various editors? Perhaps the problem is
what ends up in the clipboard (CRLF/whatever).

--

-- 
Ville M. Vainio
http://tinyurl.com/vainio
Robin | 4 Mar 09:48
Picon

Re: paste frustrations

On Wed, Mar 4, 2009 at 8:21 AM, Ludwig Schwardt
<ludwig.schwardt <at> gmail.com> wrote:
> Hi,
> As someone who had something to do with readline support for ipython on Mac
> OS X, I cringe every time I hear that word... ("readline", that is :-))
> I share your paste frustration. For the past few months I have had numerous
> mispastes into ipython, usually when pasting large blocks of code, or code
> with complicated indenting and line continuations. I first suspected my
> editor, but never really investigated the problem until now.
> The text you posted at http://www.robince.net/robince/data.txt is a real
> poison pill... When I start up ipython 0.9.1 on Mac OS 10.5.6 and paste this
> text at the terminal prompt, ipython crashes with the message:
> s_push: parser stack overflow
> ---------------------------------------------------------------------------
> MemoryError
> The IPython crash report is available on request.
> I tried pasting the text into System Python 2.5.1, which resulted in
> corrupted text (duplicated text snippets) and a resulting syntax error, but
> no crash. System Python on Mac OS X uses editline, which is a replacement
> for readline, so the problem does not seem to be readline itself. I
> confirmed this by switching off readline in ipython ("readline 0" in
> ipythonrc), which results in the same crash as before.
> The problem therefore seems to be Python itself on Mac OS X...
> Regards,
> Ludwig

I've seen that error too... Thanks very much, it's nice to know it's
not something wrong with my setup.

It seems that the data example is just over some critical length,
because large chunks of it (up to 60 or 70% by eye) paste fine, both
from the beginning and the end of the block - it is only when I paste
the whole lot that this corruption occurs.

To anser Ville - it's definitely not anything to do with the copying
stage... I have copied from a number of different apps (firefox,
macvim, another terminal window) and it is always the same. The text
in the clipboard is not corrupted - it will paste fine anywhere else
(editor, vim in terminal etc.).

In fact the best workaround I have for now (don't know why I didn't
think of it before) is to just use %edit and paste it in there - which
works fine.

Cheers

Robin

Gmane