On Wed, Feb 11, 2009 at 7:13 PM, Nick Alexander <ncalexan...@gmail.com> wrote: > >> Indeed, it was a oneliner: >> >> diff -r b0aa7ef45b3c sage/server/notebook/user_conf.py >> --- a/sage/server/notebook/user_conf.py Mon Jan 05 23:03:45 2009 -0800 >> +++ b/sage/server/notebook/user_conf.py Wed Feb 11 08:58:59 2009 -0800 >> @@ -4,7 +4,7 @@ >> import conf >> >> defaults = {'max_history_length':500, >> - 'default_system':'sage', >> + 'default_system':'python', >> 'autosave_interval':3*60, # (in seconds) >> 'default_pretty_print': False >> } >> >> >> Is there some better way, so that I don't have to modify Sage sources? > > You could monkey patch it from init.sage (you don't want to see my > init.sage): > > import sage.server.notebook.user_conf > sage.server.notebook.user_conf.defaults['default_system'] = 'python'
Thanks for the tip, I'll try it. So I got our software running in Sage over the web! Here is a very simple example: http://nb.hpfem.org:8000/home/pub/5/ It uses a mesh, that I uploaded to the worksheet, and then it loads it into our C++ code. That's it. I had to disable more interesting stuff, because it was depending on umfpack, but I had some problems installing it in Sage, and it is not needed anyway, as I want to use scipy.sparse for solving stuff, or pysparse, or pets4py or slepc4py, but I want to call it from Python, not from C++. So I need to work on this more to get everything polished, but now I can see that it will work. Great job with the notebook, it's exactly what I need! I have couple questions: 1) how can I change what gets imported by default in an empty worksheet? I use Python mode, but sage still gets imported and it polutes the namespace. :) 2) How can I get better tracebacks when something goes wrong? Example: import hermes2d m = hermes2d.Mesh() m.load() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/ondrej/nbfiles/worksheets/ondrej/0/code/7.py", line 6, in <module> print _support_.syseval(python, ur'''m.load()''', '/home/ondrej/nbfiles/worksheets/ondrej/0/cells/12') File "/home/ondrej/ext/sage-3.2.3-Debian4.0-32bit-Intel-i686-Linux/local/lib/python2.5/site-packages/sage/server/support.py", line 323, in syseval return system.eval(cmd) TypeError: eval() takes at least 3 arguments (2 given) The m.load() expects one parameter, I didn't give it any, but it is not apparent from the tracebakc what went wrong. 3) I want to use matplotlib for plotting, or maybe some other library, in any case the result will be a png image. Here are couple examples how it can be used in the notebook: http://nb.hpfem.org:8000/home/pub/2/ http://nb.hpfem.org:8000/home/pub/3/ http://nb.hpfem.org:8000/home/pub/4/ Slide to the bottom of the page to see the image. However, I noticed with this approach, that if I update the plotting commands and regenerate the .png image, the result gets messed up sometimes and I had to stop the worksheet, restart it and reevaluate all cells again, then it works. Is this a known problem? What is the workaround? I am impressed how usable the notebook is. Ondrej --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---