First time here? Check out the FAQ!

Ask Your Question
3

How do I display the full output that includes graphics?

asked 13 years ago

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?

Preview: (hide)

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 ( 13 years ago )
parzan gravatar imageparzan ( 13 years ago )

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 ( 13 years ago )

2 Answers

Sort by » oldest newest most voted
3

answered 13 years ago

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.

Preview: (hide)
link

Comments

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

kcrisman gravatar imagekcrisman ( 13 years ago )
4

answered 12 years ago

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.

Preview: (hide)
link

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 ( 10 years ago )

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: 13 years ago

Seen: 2,608 times

Last updated: Mar 13 '12