(Different) Try Python Update

2006-01-14 Thread Devan L
It's been a while since I've done anything, and I have finals, so if
anyone wants to look at some of the source, here's the somewhat cleaned
up source for bastille and modjelly. Bastille is just a
sort-of-more-secure equivalent of what the code module is, in case you
have no clue what it does since I haven't really mentioned it.

Bastille: 
Modjelly: 

On a side note, I just realized that due to some bug, any function
definition after the first function is defined simply binds the name to
the first one, which is a very bad thing! So if you can find anything
related to this in the source, send me an email.

Oh, right, and in case you have no clue what I'm talking about, I'm
trying to replicate an interactive session online. My Try Python is at
 and Mike Meyer's
cooler one is at .

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-08 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes:
> Meanwhile, other JS/DOM experts have told me that there's NO way to set
> cursor position within a textarea according to w3c standards.  In this
> case, what your site does now may be the "least bad" approach, and that
> fact might be noted in the "browsers" subpage, together with a request
> for anybody who has other ideas to submit them, I guess.

I've done that, and it should show up next time I push the code to the
production server.

> Sorry for wasting your time, I'm still having trouble believing that the
> standards didn't bother to specify SOME way to perform such an
> elementary functionality.

How many pages do you know of that actually want to do this? It may be
fundamental, but it's atypical. I found three different ways to do it
- none of them supported by Safari. Ironically, the browsers that do
support any of those methods all keep the cursor at the end of the
textarea when I add the new text, and so don't need them.

 Thanks,
   http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-08 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote:

> [EMAIL PROTECTED] (Alex Martelli) writes:
> > I'm finding it hard to arrange my own experiments with Safari (I'm using
> > a loaner machine since my normal one[s] are all having problems and
> > under repair) but I'm told the solution for cursor positioning is to set
> > the caretPos attribute of the textarea, like for example at
> >  ...
> 
> caretPos is apparently an MS extension; it's not supported by Safari
> or the Gecko browsers.
> 
> setSelectionRange is the standards-compliant version. It's not
> supported by Safari either :-(.

Meanwhile, other JS/DOM experts have told me that there's NO way to set
cursor position within a textarea according to w3c standards.  In this
case, what your site does now may be the "least bad" approach, and that
fact might be noted in the "browsers" subpage, together with a request
for anybody who has other ideas to submit them, I guess.

Sorry for wasting your time, I'm still having trouble believing that the
standards didn't bother to specify SOME way to perform such an
elementary functionality.


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-08 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes:
> I'm finding it hard to arrange my own experiments with Safari (I'm using
> a loaner machine since my normal one[s] are all having problems and
> under repair) but I'm told the solution for cursor positioning is to set
> the caretPos attribute of the textarea, like for example at
>  ...

caretPos is apparently an MS extension; it's not supported by Safari
or the Gecko browsers.

setSelectionRange is the standards-compliant version. It's not
supported by Safari either :-(.

  Thanks,
http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-08 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote:

> [EMAIL PROTECTED] (Alex Martelli) writes:
> > Mike Meyer <[EMAIL PROTECTED]> wrote:
> > For some reason, I couldn't see the links at the end of the page; now I
> > can, though they look sort of "ragged", but, OK.
> 
> Probably the fonts I chose. I'm in no way a good visual designer. I'm
> hoping someone who is will step up to help with this.

I'm finding it hard to arrange my own experiments with Safari (I'm using
a loaner machine since my normal one[s] are all having problems and
under repair) but I'm told the solution for cursor positioning is to set
the caretPos attribute of the textarea, like for example at
 ...


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-08 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes:
> Mike Meyer <[EMAIL PROTECTED]> wrote:
> For some reason, I couldn't see the links at the end of the page; now I
> can, though they look sort of "ragged", but, OK.

Probably the fonts I chose. I'm in no way a good visual designer. I'm
hoping someone who is will step up to help with this.
   
 http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-07 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote:
   ...
> "Known problems" doesn't have URL (isn't "urlable"?) other than
> http://www.mird.org/home/mwm/try_python/. It's on that page - click on

s/mird/mired/ -- the URL as given goes to some 'oxide' thing.

> "Known Problems" to open up the section. That particular problem is

For some reason, I couldn't see the links at the end of the page; now I
can, though they look sort of "ragged", but, OK.

> If you can provide the JavaScript fragment to reliably get Safari to
> put the cursor after all the text in a textarea, I'll fix this
> now.

I'm no Safari expert (and no great shakes at Javascript!), but, I'll ask
around and report back here, thanks.


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-07 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes:
> Mike Meyer <[EMAIL PROTECTED]> wrote:
>> And yes, I know about this. It's listed in "Known Problems". Anything
> What's the URL to "Known Problems"?  There's a strange cursor-placement
> bug on Apple's Safari browser (not in Firefox), but I don't want to add
> a bug report if you already know about it -- 'Try Python' is a neat
> hack, and useful, it well deserves some care from would-be bug
> reporters... but I can't see any links to "known problems" (or other
> bug-reporting facilities) from the base page.

"Known problems" doesn't have URL (isn't "urlable"?) other than
http://www.mird.org/home/mwm/try_python/. It's on that page - click on
"Known Problems" to open up the section. That particular problem is
listed under "Tested Browsers" (which heading I'm going to change), as
I believe it's a place where the browser fails to follow the standards
- or maybe the standards fail to specify the expected behavior with
sufficient explicitness, as Safari shares this problem with OmmiWeb
and Shiira.

If you can provide the JavaScript fragment to reliably get Safari to
put the cursor after all the text in a textarea, I'll fix this
now.

 Thanx,
   http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-07 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote:

> And yes, I know about this. It's listed in "Known Problems". Anything

What's the URL to "Known Problems"?  There's a strange cursor-placement
bug on Apple's Safari browser (not in Firefox), but I don't want to add
a bug report if you already know about it -- 'Try Python' is a neat
hack, and useful, it well deserves some care from would-be bug
reporters... but I can't see any links to "known problems" (or other
bug-reporting facilities) from the base page.


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-07 Thread Devan L
Mike Meyer wrote:
> Xavier Morel <[EMAIL PROTECTED]> writes:
[Old message and Xavier's question]
[Mike's reply to Xavier]
>
> > Since Python doesn't have any way to secure the interface built-in,
> > i'd be interrested in that.
>
> Devan apparently doesn't have as cooperative an ISP, and is working on
> securing the interpreter. What he's done may be more interesting.

It's not particularily interesting. The C code simply has more
attributes restricted in restricted mode, disabling in particular
__subclasses__. The rest is creating safe __builtins__ and only giving
them some modules (but again, importing is still largely broken,
although one liners are still possible).

In any case, I don't know how secure it actually is, since nobody seems
to go further than import os or import sys. So if you're bored, you can
try to break into it. I haven't secured modjelly entirely, and it might
be possible to trick modjelly into executing code by using descriptors
when it tries to pull out all of the information. Then again, I haven't
even added support for properties in it yet. Plus it has no support for
if you delete critical attributes which are needed to recreate the
object. Still, I think it's good enough to deter any random person from
trying to wipe the server for now.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-06 Thread Mike Meyer
Xavier Morel <[EMAIL PROTECTED]> writes:
> Mike Meyer wrote:
>> The url is http://www.mired.org/home/mwm/try_python/. Reports of
>> problems would appreciated.
>> If you want to try an online P{ython tool that lets you save code,
>> try
>> Devan L's at http://www.datamech.com/devan/trypython/trypython.py.
> Mike, may I ask whether that box has been secured? And if yes how?

If you go to my try_python page and click the "Security" heading,
it'll tell you that the interpreter is run in a chrooted sandbox
inside a FreeBSD jail. You don't have access to anything in the file
system but the code needed to run the interpreter. That's all
write-protected, though I do sometimes forget to write-protect an
upgraded file. I've also removed things from the library that weren't
essential to the application.

> Since Python doesn't have any way to secure the interface built-in,
> i'd be interrested in that.

Devan apparently doesn't have as cooperative an ISP, and is working on
securing the interpreter. What he's done may be more interesting.

   http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-06 Thread Xavier Morel
Mike Meyer wrote:
> After spending time I should have been sleeping working on it, the try
> python site is much more functional. It now allows statements,
> including multi-line statements and expressions. You can't create code
> objects yet, so it's still more a programmable calculator than
> anything real.
> 
> I've got some of the tutorial text (literally) up as well. I hope to
> make it easier to read the tutorial and interact with python at the
> same time in the near future.
> 
> The url is http://www.mired.org/home/mwm/try_python/. Reports of
> problems would appreciated.
> 
> If you want to try an online P{ython tool that lets you save code, try
> Devan L's at http://www.datamech.com/devan/trypython/trypython.py.
> 
>   http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-05 Thread Mike Meyer
Steven Bethard <[EMAIL PROTECTED]> writes:
> Mike Meyer wrote:
>> The url is http://www.mired.org/home/mwm/try_python/. Reports of
>> problems would appreciated.
> You're probably already aware of this, but the online help utility
> doesn't work.  It exits before you can type anything into it:

Actually, I'd say the interactive help utility doesn't work. As long
as you don't use it interactively, it works fine. You can do
help(int) (for instance) and so on.

And yes, I know about this. It's listed in "Known Problems". Anything
that tries to read from standard input  will fail. I'm thinking about
fixes, but  it's not a high-priority item at the moment.

   Thanks  for the report.
 http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-05 Thread Steven Bethard
Mike Meyer wrote:
> The url is http://www.mired.org/home/mwm/try_python/. Reports of
> problems would appreciated.

You're probably already aware of this, but the online help utility 
doesn't work.  It exits before you can type anything into it:

--
 >>> help()

Welcome to Python 2.4!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://www.python.org/doc/tut/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help>
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)".  Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
 >>>
--

STeVe
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-04 Thread Mike Meyer
"Szabolcs Nagy" <[EMAIL PROTECTED]> writes:
> Hello
> Thanks for trypython, it's a cool idea

Thank you.

> I got TryPythonError after an IdentationError and i could not get rid
> of it (other than refreshing the page):
>
> Python 2.4.2 (#3, Dec 16 2005, 23:54:20)
> [GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
> Type "help", "copyright", "credits", or "license" for more information.
 if 1:
> ... qwerty
> IndentationError: expected an indented block (, line 2)
 a=2
> TryPythonError: I couldn't find the prompt, so did nothing
 1
> TryPythonError: I couldn't find the prompt, so did nothing
 
> TryPythonError: I couldn't find the prompt, so did nothing


Thanks for the report. It's fixed, and all I had to do was totally
restructure the routine that did all the work. But I like the new
structure better.

http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-04 Thread Szabolcs Nagy
Hello
Thanks for trypython, it's a cool idea

I got TryPythonError after an IdentationError and i could not get rid
of it (other than refreshing the page):

Python 2.4.2 (#3, Dec 16 2005, 23:54:20)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type "help", "copyright", "credits", or "license" for more information.
>>> if 1:
... qwerty
IndentationError: expected an indented block (, line 2)
>>> a=2
TryPythonError: I couldn't find the prompt, so did nothing
>>> 1
TryPythonError: I couldn't find the prompt, so did nothing
>>> 
TryPythonError: I couldn't find the prompt, so did nothing
>>>

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-04 Thread Mike Meyer
"Bas" <[EMAIL PROTECTED]> writes:
> You could somehow combine the official tuturial (or any other good
> introductory text) and make all the examples in the text 'live'. Maybe
> use a split screen with the tutorial text on one side and the trypython
> console on the other. The newbie could then immediately try the example
> by typing it over himself or by clicking a button 'run in console' next
> to the example. Target audience should be only the real beginners who
> are afraid/too lazy to install the complete Python enviroment. Advanced
> users should be able to do a full install themselves.

This is pretty much what I had in mind. I'm moving the tutorial into
the thing (slowly). I've set it up as two regions one above the
other. The text of the tutorial will scroll in that region if it needs
to. The console region may be scrollable as well, depending on the
fonts and sizes that get used for the console window. I go through the
text of the tutorial typing in the expressions and verifying that I
get the correct results back.

Making the examples links that insesrt the text of the example?
Certainly possible. I'm not sure I want to do that, though. I think
people learn better if they actually do things themselves, and I'm not
sure that clicking a link qualifieas as "doing it themselves."

 Thanks,
   http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-04 Thread Bas
To expand on this idea:

You could somehow combine the official tuturial (or any other good
introductory text) and make all the examples in the text 'live'. Maybe
use a split screen with the tutorial text on one side and the trypython
console on the other. The newbie could then immediately try the example
by typing it over himself or by clicking a button 'run in console' next
to the example. Target audience should be only the real beginners who
are afraid/too lazy to install the complete Python enviroment. Advanced
users should be able to do a full install themselves.

Cheers,
Bas

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-04 Thread [EMAIL PROTECTED]
> I think that the code constructor (types.CodeType) doesn't take
> co_freevars or co_cellvars as an arg, so I can't directly create a new
> code object from the attribute of the old one with co_freevars and
> co_cellvars.

Yay for hidden documentation:

"code(argcount, nlocals, stacksize, flags, codestring, constants,
names, varnames, filename, name, firstlineno, lnotab[, freevars[,
cellvars]])

Create a code object.  Not for the faint of heart."

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-03 Thread Devan L
Mike Meyer wrote:
> [EMAIL PROTECTED] writes:
[comments about Mike Meyer's try python, I think]
> > I had no trouble with from math import *  followed by print pi, but
> > there was no >>> prompt after the result appeared .. is that part of
> > the 'closures' thing mentioned earlier?
>
> Hmm. Are you looking at mine  http://www.mired.org/home/mwm/try_python/ >, or Devans  http://www.datamech.com/devan/trypython/trypython.py >? Mine doesn't
> handle code (though he's provide pointers I plan on using to make it
> do so). I think he said his has problems with closures.

I'm renaming mine to the Python Online REPL or Online Python REPL,
whichever you prefer, to help differentiate from Mike's.

>From the actual recipe:

(The url changes every day as they move it one day back)
if co.co_freevars or co.co_cellvars:
raise ValueError, "Sorry, cannot pickle code objects from
closures"

I think that the code constructor (types.CodeType) doesn't take
co_freevars or co_cellvars as an arg, so I can't directly create a new
code object from the attribute of the old one with co_freevars and
co_cellvars. I might be able to set the attributes after,but I'll have
to test it out to see.

> > Then I followed you "type 'help'" suggestion, which had me in stitches
> > (sorry, it's been a long day and the Knob Creek was kicking in) -- I
> > got exactly the message you'd expect, about help not being recognized
> > and maybe help() would work. That's what triggered the idea for
> > trapping errors.
>
> Hmm. help seems to work fine in both of them. license() fails the same
> way in both of them (it tries to read from stdin, so), which means
> that you can probalby make help fail on them both if you work at it.
>

Printing and most things not explicitly called by my code isn't done
correctly (strings to lines to strings again!), so most any printing
non-single statements or input will probably break it.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-03 Thread Devan L

[EMAIL PROTECTED] wrote:
> I like the form, no matter what its limitations may be. Three notes:
>
> It might be a good way to catch newbi mistakes (those are the kind I
> make :P, thereby providing a feedback loop to improved error messages.
>
> I had no trouble with from math import *  followed by print pi, but
> there was no >>> prompt after the result appeared .. is that part of
> the 'closures' thing mentioned earlier?
>
> Then I followed you "type 'help'" suggestion, which had me in stitches
> (sorry, it's been a long day and the Knob Creek was kicking in) -- I
> got exactly the message you'd expect, about help not being recognized
> and maybe help() would work. That's what triggered the idea for
> trapping errors.
>
> Nice work!
>
> George

Uh, I'm messing with import right now, but essentially, I wouldn't
recommend importing (one line __import__ hacks only!) or printing.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-03 Thread Mike Meyer
[EMAIL PROTECTED] writes:
> I like the form, no matter what its limitations may be. Three notes:
>
> It might be a good way to catch newbi mistakes (those are the kind I
> make :P, thereby providing a feedback loop to improved error messages.

I'm doing almost no error catching. I think I catch two:

If you muck with the prompt, it throws away what you sent it, because
I'd have to guess at the expression.

There were (I think I worked around them) browser bugs that caused
the result of an expression to get lost - it notices that, and tells
you about it.

Well, I do catch exceptions in general, to tailor the traceback for
the environment. But that's all I do.

> I had no trouble with from math import *  followed by print pi, but
> there was no >>> prompt after the result appeared .. is that part of
> the 'closures' thing mentioned earlier?

Hmm. Are you looking at mine http://www.mired.org/home/mwm/try_python/ >, or Devans http://www.datamech.com/devan/trypython/trypython.py >? Mine doesn't
handle code (though he's provide pointers I plan on using to make it
do so). I think he said his has problems with closures.

> Then I followed you "type 'help'" suggestion, which had me in stitches
> (sorry, it's been a long day and the Knob Creek was kicking in) -- I
> got exactly the message you'd expect, about help not being recognized
> and maybe help() would work. That's what triggered the idea for
> trapping errors.

Hmm. help seems to work fine in both of them. license() fails the same
way in both of them (it tries to read from stdin, so), which means
that you can probalby make help fail on them both if you work at it.

 thanks,
   http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-03 Thread browerg
I like the form, no matter what its limitations may be. Three notes:

It might be a good way to catch newbi mistakes (those are the kind I
make :P, thereby providing a feedback loop to improved error messages.

I had no trouble with from math import *  followed by print pi, but
there was no >>> prompt after the result appeared .. is that part of
the 'closures' thing mentioned earlier?

Then I followed you "type 'help'" suggestion, which had me in stitches
(sorry, it's been a long day and the Knob Creek was kicking in) -- I
got exactly the message you'd expect, about help not being recognized
and maybe help() would work. That's what triggered the idea for
trapping errors.

Nice work!

George

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-03 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> Very nice :)
>
> I found this online Ruby tutorial:
>   http://tryruby.hobix.com/

That's what inspired me to create my version.

> I think it would be cool to have something similar for Python. Want to
> go further and make a nice tutorial to accompany this :) 

Well, *I* like the python.org tutorial. I've already started steal,
uh, using, material from it. I intend to include more as time goes
by.

One thing that annoyed me about the tryruby version is that it changed
the text - apparently arbitrarily - with each expression. I *detest*
UI's that change things when they want to (I regularly close dialogs
accidently on OSX because they come up while I'm working in *some
other application* and steal the focus from me). I'm not going to do
that; that's why I list all the sections, and you can display (or not)
by clicking on them. I'm planning on adding a "suggested reading" link
(it's already there if you know where to look, but always does the
same thing :-) under the console that will do what the ruby thing
does, except when the user asks for it, not when I think it should
happen.

  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-03 Thread [EMAIL PROTECTED]
Very nice :)

I found this online Ruby tutorial:
  http://tryruby.hobix.com/

I think it would be cool to have something similar for Python. Want to
go further and make a nice tutorial to accompany this :) 

wy

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-01 Thread Mike Meyer
"Devan L" <[EMAIL PROTECTED]> writes:
>> > On a side note, my brother has tinkered with the C internals and now
>> > __subclasses__ is restricted and many, many os and posix commands are
>> > restricted (not that you can get them anyways, since importing is
>> > broken!)
>> I got import to work by pickling pairs of names - the variable name
>> that references the module, and the name of the module. When it
>> unpickles the list, it reimports them and points the appropriate
>> variable at them. This had unwanted effects if you did an "import
>> this". It also doesn't work for objects that contain references to
>> modules.
> My general method of storing is to store everything possible. See a
> function? Store the function object itself. See a class? Store the
> class object. Unfortunately, I can't store builtin methods or
> functions, so this breaks on most modules. Don't try to reference the
> __builtins__, by the way, otherwise it won't be removed and modjelly
> will break.

I think the idea I used for modules would generalize: If you can't
store it, store the information you need to relocate it, and recreate
the binding.

>> I tried for a bit to restrict things, then gave up and did it
>> externally. There's no access to any files but those required to run
>> the script that deals with thing, and some other python modules that I
>> decided would be nice to have. Normally, nothing in the tree is
>> writable, either. Once I'm happy with it, I'll save a copy of the tree
>> somewhere and set up a cron job to "refresh" it at regular intervals.
> I don't have enough control on the server to effectively restrict it
> externally (no running as an unprivelleged user!), so I have to lock it
> down as tightly as possible internally.

My ISP provides this facility. They provided a less strict version,
and worked with me to create this facility. While they aren't perfect,
I can't say enough good things about them. If you need internet
connectivity, web hosting, whatever - idiom.com is good people to work
with.

  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-01 Thread Devan L
Mike Meyer wrote:
> "Devan L" <[EMAIL PROTECTED]> writes:
> >> If you want to try an online P{ython tool that lets you save code, try
> >> Devan L's at http://www.datamech.com/devan/trypython/trypython.py.
> > My code uses one of the recipes from the Python Cookbook, 7.6 Pickling
> > Code Objects. It's limited to closures though, just like in the recipe.
> > So uh, you can't write closures in mine.
>
> I don't have the dead trees version, and the online version doesn't
> have chapter numbers. Is that  http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/212565>?

It was one of the recipes of the day, actually. They don't keep them up
for more than a week, though, I think. But more or less it has all of
the attributes used for creating an object from types.CodeType in
correct order.

> > On a side note, my brother has tinkered with the C internals and now
> > __subclasses__ is restricted and many, many os and posix commands are
> > restricted (not that you can get them anyways, since importing is
> > broken!)
>
> I got import to work by pickling pairs of names - the variable name
> that references the module, and the name of the module. When it
> unpickles the list, it reimports them and points the appropriate
> variable at them. This had unwanted effects if you did an "import
> this". It also doesn't work for objects that contain references to
> modules.

My general method of storing is to store everything possible. See a
function? Store the function object itself. See a class? Store the
class object. Unfortunately, I can't store builtin methods or
functions, so this breaks on most modules. Don't try to reference the
__builtins__, by the way, otherwise it won't be removed and modjelly
will break.


> I tried for a bit to restrict things, then gave up and did it
> externally. There's no access to any files but those required to run
> the script that deals with thing, and some other python modules that I
> decided would be nice to have. Normally, nothing in the tree is
> writable, either. Once I'm happy with it, I'll save a copy of the tree
> somewhere and set up a cron job to "refresh" it at regular intervals.

I don't have enough control on the server to effectively restrict it
externally (no running as an unprivelleged user!), so I have to lock it
down as tightly as possible internally.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-01 Thread Mike Meyer
"Devan L" <[EMAIL PROTECTED]> writes:
>> If you want to try an online P{ython tool that lets you save code, try
>> Devan L's at http://www.datamech.com/devan/trypython/trypython.py.
> My code uses one of the recipes from the Python Cookbook, 7.6 Pickling
> Code Objects. It's limited to closures though, just like in the recipe.
> So uh, you can't write closures in mine.

I don't have the dead trees version, and the online version doesn't
have chapter numbers. Is that http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/212565>?

> On a side note, my brother has tinkered with the C internals and now
> __subclasses__ is restricted and many, many os and posix commands are
> restricted (not that you can get them anyways, since importing is
> broken!)

I got import to work by pickling pairs of names - the variable name
that references the module, and the name of the module. When it
unpickles the list, it reimports them and points the appropriate
variable at them. This had unwanted effects if you did an "import
this". It also doesn't work for objects that contain references to
modules.

I tried for a bit to restrict things, then gave up and did it
externally. There's no access to any files but those required to run
the script that deals with thing, and some other python modules that I
decided would be nice to have. Normally, nothing in the tree is
writable, either. Once I'm happy with it, I'll save a copy of the tree
somewhere and set up a cron job to "refresh" it at regular intervals.

http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-01 Thread Devan L

Mike Meyer wrote:
> After spending time I should have been sleeping working on it, the try
> python site is much more functional. It now allows statements,
> including multi-line statements and expressions. You can't create code
> objects yet, so it's still more a programmable calculator than
> anything real.
>
> I've got some of the tutorial text (literally) up as well. I hope to
> make it easier to read the tutorial and interact with python at the
> same time in the near future.
>
> The url is http://www.mired.org/home/mwm/try_python/. Reports of
> problems would appreciated.
>
> If you want to try an online P{ython tool that lets you save code, try
> Devan L's at http://www.datamech.com/devan/trypython/trypython.py.

My code uses one of the recipes from the Python Cookbook, 7.6 Pickling
Code Objects. It's limited to closures though, just like in the recipe.
So uh, you can't write closures in mine.

On a side note, my brother has tinkered with the C internals and now
__subclasses__ is restricted and many, many os and posix commands are
restricted (not that you can get them anyways, since importing is
broken!)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Try Python update

2006-01-01 Thread UrsusMaximus
Cool. I think its really a good thing. Could come in handy when one is
on a strange Windows machine with no Python installed, or when using a
PDA that doesn't have Python etc. 

And its just a neat feat. ;-)))

Ron

-- 
http://mail.python.org/mailman/listinfo/python-list


Try Python update

2006-01-01 Thread Mike Meyer
After spending time I should have been sleeping working on it, the try
python site is much more functional. It now allows statements,
including multi-line statements and expressions. You can't create code
objects yet, so it's still more a programmable calculator than
anything real.

I've got some of the tutorial text (literally) up as well. I hope to
make it easier to read the tutorial and interact with python at the
same time in the near future.

The url is http://www.mired.org/home/mwm/try_python/. Reports of
problems would appreciated.

If you want to try an online P{ython tool that lets you save code, try
Devan L's at http://www.datamech.com/devan/trypython/trypython.py.

http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list