[Tutor] Online interpreter?

Rob Andrews rob@jam.rr.com
Mon, 16 Jul 2001 16:58:08 -0500


It looks like Python Server Pages may provide a solution, as well.

http://jpython.dhs.org/pspdocs/samples.htm (I snipped this out of some
frames, FYI.)

One of the samples (including source) is the *Run Code* example. I have yet
to install PSP to verify this, but they profess that "Its purpose is to
allow you to enter a block of JPython code, have that code executed, and
return any results generated back to you."

I'm really interested in PSP, but have yet to play with it.

Rob

"Perl is worse than Python because people wanted it worse." Larry Wall
(Creator of Perl), 14 Oct 1998
Useless Python: http://www.lowerstandard.com/python/

# -----Original Message-----
# From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
# Michael P. Reilly
# Sent: Monday, July 16, 2001 2:20 PM
# To: Mike Serpa
# Cc: tutor@python.org
# Subject: Re: [Tutor] Online interpreter?
#
#
# Mike Serpa wrote
# > There isn't an online interpreter of Python somewhere is there? Like
# > this one I found for Ruby?  http://www.ruby.ch/en/rubymain.shtml
# >
# > Sometimes I want to try some things out on Python when I'm away from my
# > PC.
#
# The easiest method, imo, would be to make a JPython applet wrapped around
# an instance of code.InteractiveConsole.
#
# Otherwise, if you just had CGI, make a picklable rexec class and wrap
# the CGI around it.
#
# class PicklableRexec(rexec.RExec):
#   # keep state between CGI calls
#   def __getstate__(self):
#     # modules loaded
#     modnames = self.modules.keys()
#     # main module values, do not include modules
#     mainmod = self.modules['__main__']
#     mainvals = []
#     mainmods = []
#     for name, value in mainmod.__dict__.items():
#       if not isinstance(value, types.ModuleType):
#         mainvals.append( (name, value) )
#       else:
#         mainmods.append( name )
#     return (modnames, mainvals, mainmods)
#   def __setstate__(self, (modnames, mainvals, mainmods)):
#     self.__init__()
#     for name in modnames:
#       self.r_import(name)
#     for name in mainmods:
#       self.r_exec('input %s' % name)
#     mainmod = self.modules['__main__']
#     for (name, value) in mainvals:
#       setattr(mainmod, name, value)
#
# Pickling an instance of this will create a text string that can be passed
# to the next HTML form, properly quoted of course.  When submitting the
# form, unpickle the string to get the current state.  The input string can
# be called through the s_exec method.  May have to fix up the I/O for CGI.
#
#   -Arcege
#
# --
# +----------------------------------+-----------------------------------+
# | Michael P. Reilly                | arcege@speakeasy.net              |
#
# _______________________________________________
# Tutor maillist  -  Tutor@python.org
# http://mail.python.org/mailman/listinfo/tutor