Sorry! :"> Use load. On 22 feb, 17:20, Francisco Botana <fbot...@uvigo.es> wrote: > Hi, > > I've defined a list of Sage functions. For instance, > ----------------------------- > def plus(a,b): > return a+b > > def times(a,b): > return a*b > > .... > --------------------------- > Now, I want to launch the simple server in such a way that these > functions are defined. I mean, executing > > https://<IP>:<port>/simple/compute?session=<session>&code=plus(3,1) > > I would like to obtain > > { > "status": "done", > "files": [], > "cell_id": 1} > > ___S_A_G_E___ > > 2 > > Thanks in advance. > > PS > > For launching and remotely accessing the simple server I use > -------------------------------------------------- > import time, os, random > > from sage.server.misc import find_next_available_port > from sage.server.notebook.notebook_object import test_notebook > port = find_next_available_port(9000, verbose=False) > passwd = hex(random.randint(1,1<<128)) > > f = open('notebook_info.txt', 'w') > > # create a new, empty notebook with a single user > nb = test_notebook(passwd, secure=False, address='localhost', port=port, > verbose=True) > > f.write("%s\n%s\n" % (port, passwd)) > f.close() > > print "Press control-C to stop." > > try: > # wait until a ^C > while True: > time.sleep(10) > except KeyboardInterrupt: > pass > > print "Killing notebook." > nb.dispose() > --------------------------------------------
-- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org