On Mar 5, 4:40 pm, Jason Grout <[email protected]> wrote:
> thelamecamel wrote:
> > I no longer think it's a problem with the interface to mathematica - I
> > can print the output from mathematica before and after doing the
> > replace()s, and the corruption definitely happens between the two
> > print statements.
>
> You have 4 replace statements in there. Can you narrow down which is
> causing a problem?
Hi Jason,
It appears to be the last, the .replace('\n',' ') . It still
complains about invalid syntax if I leave out the .replace('\n',' '),
but this is probably because the input is now spread over multiple
lines.
Displaying rather than printing the troublesome string immediately
before the .replace('\n',' '), i.e. typing "my_str" at a sage prompt
rather than "print my_str", I notice that while most of the newlines
are represented as "\n", one is "\r\n", and the "\r\n" is positioned
in the middle of the trouble. I changed my code so that it also
replaces "\r" with ' ', and now it works.
Do you think that this behaviour is a bug in sage_eval() / eval(), and
if so, where should I report it?
Thanks for the help troubleshooting.
Cheers,
Felix
>
> something like:
>
> my_str = repr(res[i+1][1])
> my_str = my_str.replace('{','[')
> print my_str
> my_str = my_str.replace('}',']')
> print my_str
>
> etc.
>
> Jason
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---