# Error in looking at source code

Every so often, I try to look at the source code for some function. It often doesn't work. There is a commonality to the times where it doesn't work. The source code usually has examples in it. And, often there are examples of things that don't work, that cause errors, where the error messages are shown in the source code. It is these examples that seem to cause the problems. The source code prints out up to the error message and then it just stops. Since this happens before it ever gets to the actual source code, I can't see the source code.

The latest source code I tried to view is:

 sage.graphs.graph_coloring.all_graph_colorings??


The last thing I see in the source code is:

 sage: for C in all_graph_colorings(G,-1): print C
Traceback (click to the left of this block for traceback)
...


I am using Firefox 11 to access Sage on a server, in case that matters. It has been happening for a while, so also it has applied in some previous versions of Firefox as well.

UPDATE: I'm just trying to bring more attention to this. It looks to me as though this problem is known but no one seems to be working on it (based on the Trac ticket and the further link to Github in the Trac ticket). I can't even use the workaround mentioned below in the answer (using Sage 4.8 in the notebook), i.e., I'm trying to "click to the left" over and over and nothing ever happens. I'm trying to view the source code for graph coloring and it's just not possible, or I can't figure it out. Now, it's actually worse than I mentioned before. I shift-enter to see the source code. It gets stopped as mentioned above, BUT it's still evaluating something and won't stop. I try to interrupt and it doesn't work. I have to restart the notebook.

UPDATE 2: Sorry to bother you, but finally I was able to click to the left and see the code. Not sure what was going on. I was clicking to the left and the result had been (several times) to hide all the output but just have a little gray bar there. Then, clicking a couple more times would bring it back to the form where it stopped at the error.

edit retag close merge delete

Sort by » oldest newest most voted

This is a known problem: See trac ticket #11913. Unfortunately, the problem isn't resolved yet.

Two possible workarounds:

1. If you do "click to the left of this block", then the complete source is shown. I don't know what happens if the doc string contains several tracebacks, though.
2. Use the command line version of Sage: The problem is specific to the Notebook.
more

I don't use command line. I'm working on a server. But, thanks for the info.

( 2012-04-15 03:28:32 -0600 )edit