Ask Your Question
3

How do I display the full output that includes graphics?

asked 2011-03-30 20:59:24 +0100

Sammy Black gravatar image

Background

I am working in the notebook GUI.

I have code that produces graphics (.png files) to display arrays with colors satisfying certain combinatorial criteria. When the output gets too long, Sage returns the message

WARNING: Output truncated!
full_output.txt

The .txt file contains some html code, but doesn't display in a web browser.

Question

How do I see my graphical arrays?

edit retag flag offensive close merge delete

Comments

It would be very helpful to have a minimal case that produces this. You can get it by having a loop like "for i in range(100000): print factorial(i)" but I haven't seen it in this context.

kcrisman gravatar imagekcrisman ( 2011-03-30 23:40:08 +0100 )edit
parzan gravatar imageparzan ( 2011-04-02 19:25:46 +0100 )edit

By the way, wrapping the .txt file in standard HTML headers and <body> etc. then renaming that to html *might* work... just a random chance.

kcrisman gravatar imagekcrisman ( 2011-04-02 23:37:13 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
3

answered 2011-04-05 23:47:47 +0100

Jason Grout gravatar image

Try writing your output to an html file. Do something like:

f=open('myoutput.html','w')
f.write(some output)
f.write(some more output)
f.close()

That file should appear as a link in the output of the cell. If you click on the link, you should see your output as an html file.

edit flag offensive delete link more

Comments

This could be helpful to have on the standard notebook help page as an FAQ or something.

kcrisman gravatar imagekcrisman ( 2011-04-06 09:29:47 +0100 )edit
4

answered 2012-03-13 15:05:15 +0100

akm gravatar image

I found this solves the problem: put this line in your notebook cell before you create output.

html('<!--notruncate-->')

Worked for me.

edit flag offensive delete link more

Comments

This is very helpful! It can also be inserted in the definition of a function. A 2009 suggestion on the sage-support list was to change values of variables in the file devel/sage/sage/server/notebook/cell.py and rebuild SAGE, which isn't feasible in many cases, such as when using SAGE in a classroom where it's been installed on multiple machines. Since there are pedagogical scenarios where we'd like all of the output to display, may I suggest that this solution be mentioned in the SAGE reference manual? (Searching for "notruncate" in version 6.4.1 of the manual produces three hits, none quite containing this solution.)

gtmarks gravatar imagegtmarks ( 2015-01-26 01:20:48 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2011-03-30 20:59:24 +0100

Seen: 2,599 times

Last updated: Mar 13 '12