Re: If Scheme is so good why MIT drops it?

2009-07-22 Thread Ron Garret
In article , Neil Hodgson wrote: > milanj: > > > and all of them use native threads (python still use green threads ?) > >Python uses native threads. But then it adds the global interpreter lock, which completely undermines the utility of native threads. So yes, it uses native threads,

Re: Yet another unicode WTF

2009-06-04 Thread Ron Garret
In article , Lawrence D'Oliveiro wrote: > In message , Ron > Garret wrote: > > > Python 2.6.2 on OS X 10.5.7: > > Same result, Python 2.6.1-3 on Debian Unstable. My $LANG is en_NZ.UTF-8. > > > ... I always thought one of the fundamental > > invaria

Yet another unicode WTF

2009-06-04 Thread Ron Garret
Python 2.6.2 on OS X 10.5.7: [...@mickey:~]$ echo $LANG en_US.UTF-8 [...@mickey:~]$ cat frob.py #!/usr/bin/env python print u'\u03BB' [...@mickey:~]$ ./frob.py ª [...@mickey:~]$ ./frob.py > foo Traceback (most recent call last): File "./frob.py", line 2, in print u'\u03BB' UnicodeEncodeE

distutils extension configuration problem

2009-05-26 Thread Ron Garret
I'm trying to build PyObjC on an Intel Mac running OS X 10.5.7. The build is breaking because distutils seems to want to build extension modules as universal binaries, but some of the libraries it depends on are built for intel-only, i.e.: [...@mickey:~/Desktop/pyobjc-framework-ScreenSaver-2.2

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Ron Garret
In article <499f397c.7030...@v.loewis.de>, "Martin v. Löwis" wrote: > > Yes, I know that. But every concrete representation of a unicode string > > has to have an encoding associated with it, including unicode strings > > produced by the Python parser when it parses the ascii string "u'\xb5'"

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Ron Garret
In article <499f3a8f.9010...@v.loewis.de>, "Martin v. Löwis" wrote: > > u'\xb5' > >> u'\xb5' > > print u'\xb5' > >> ? > > > > Unicode literals are *in the source file*, which can only have one > > encoding (for a given source file). > > > >> (That last character shows up as a micron si

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Ron Garret
In article <499f18bd$0$31879$9b4e6...@newsspool3.arcor-online.net>, Stefan Behnel wrote: > Ron Garret wrote: > > I would have thought that the answer would be: the default encoding > > (duh!) But empirically this appears not to be the case: > > > >>&g

Re: To unicode or not to unicode

2009-02-20 Thread Ron Garret
In article <499f0cf0.8070...@v.loewis.de>, "Martin v. Löwis" wrote: > MRAB wrote: > > Thorsten Kampe wrote: > >> * Ron Garret (Thu, 19 Feb 2009 18:57:13 -0800) > >>> I'm writing a little wiki that I call µWiki. That's a lowercase >

What encoding does u'...' syntax use?

2009-02-20 Thread Ron Garret
I would have thought that the answer would be: the default encoding (duh!) But empirically this appears not to be the case: >>> unicode('\xb5') Traceback (most recent call last): File "", line 1, in UnicodeDecodeError: 'ascii' codec can't decode byte 0xb5 in position 0: ordinal not in range(

Re: To unicode or not to unicode

2009-02-20 Thread Ron Garret
In article , MRAB wrote: > Thorsten Kampe wrote: > > * Ron Garret (Thu, 19 Feb 2009 18:57:13 -0800) > >> I'm writing a little wiki that I call µWiki. That's a lowercase Greek > >> mu at the beginning (it's pronounced micro-wiki). > > &g

To unicode or not to unicode

2009-02-19 Thread Ron Garret
I'm writing a little wiki that I call µWiki. That's a lowercase Greek mu at the beginning (it's pronounced micro-wiki). It's working, except that I can't actually enter the name of the wiki into the wiki itself because the default unicode encoding on my Python installation is "ascii". So I'm

Re: Regular expression bug?

2009-02-19 Thread Ron Garret
In article , Albert Hopkins wrote: > On Thu, 2009-02-19 at 10:55 -0800, Ron Garret wrote: > > I'm trying to split a CamelCase string into its constituent components. > > This kind of works: > > > > >>> re.split('[a-z][A-Z]', 'fooBar

Re: Regular expression bug?

2009-02-19 Thread Ron Garret
In article , "andrew cooke" wrote: > i wonder what fraction of people posting with "bug?" in their titles here > actually find bugs? IMHO it ought to be an invariant that len(r.split(s)) should always be one more than len(r.findall(s)). > anyway, how about: > > re.findall('[A-Z]?[a-z]*', 'fo

Re: Regular expression bug?

2009-02-19 Thread Ron Garret
In article , Peter Otten <__pete...@web.de> wrote: > Ron Garret wrote: > > > I'm trying to split a CamelCase string into its constituent components. > > How about > > >>> re.compile("[A-Za-z][a-z]*").findall("fooBarBaz") > [&#

Re: Regular expression bug?

2009-02-19 Thread Ron Garret
In article , MRAB wrote: > Ron Garret wrote: > > I'm trying to split a CamelCase string into its constituent components. > > This kind of works: > > > >>>> re.split('[a-z][A-Z]', 'fooBarBaz') > > ['fo', 'a&#x

Regular expression bug?

2009-02-19 Thread Ron Garret
I'm trying to split a CamelCase string into its constituent components. This kind of works: >>> re.split('[a-z][A-Z]', 'fooBarBaz') ['fo', 'a', 'az'] but it consumes the boundary characters. To fix this I tried using lookahead and lookbehind patterns instead, but it doesn't work: >>> re.spli

Re: WebError documentation?

2009-02-07 Thread Ron Garret
In article <498de947$0$24412$426a7...@news.free.fr>, Bruno Desthuilliers wrote: > Ron Garret a écrit : > > In article , > > Chris Rebert wrote: > > > >> On Thu, Feb 5, 2009 at 12:52 PM, Ron Garret wrote: > >>> Is there any? Where is it? Ex

Re: WebError documentation?

2009-02-07 Thread Ron Garret
In article , Chris Rebert wrote: > On Thu, Feb 5, 2009 at 12:52 PM, Ron Garret wrote: > > Is there any? Where is it? Extensive Googling has proven fruitless. > > It's not a standard Python exception. A third-party library you're > using must be raising it. Check

WebError documentation?

2009-02-06 Thread Ron Garret
Is there any? Where is it? Extensive Googling has proven fruitless. Thanks, rg -- http://mail.python.org/mailman/listinfo/python-list

Re: Extreme Yaro weirdness

2009-02-02 Thread Ron Garret
In article , "Gabriel Genellina" wrote: > En Mon, 02 Feb 2009 06:59:16 -0200, Ron Garret > escribió: > > > I'm running the following WSGI app under Yaro: > > > > def error(req): > > try: > > req.non_existent_key > > e

Extreme Yaro weirdness

2009-02-02 Thread Ron Garret
I'm running the following WSGI app under Yaro: def error(req): try: req.non_existent_key except: try: return cgitb.html(sys.exc_info()) except: return 'foo' The result of running this is 'foo'. In other words, the reference to the non-existent key generates an except

Re: More mod_wsgi weirdness: process restarts on redirect

2009-01-30 Thread Ron Garret
In article <63cf7deb-f15c-4259-aa24-1b8da8468...@r41g2000prr.googlegroups.com>, Graham Dumpleton wrote: > On Jan 30, 11:01 am, Ron Garret wrote: > > In article , > >  Joshua Kugler wrote: > > > > > Ron Garret wrote: > > > > My question is:

Re: Sloooooowwwww WSGI restart

2009-01-30 Thread Ron Garret
In article <146f6796-37b5-4220-bdb1-5119cb3ac...@z6g2000pre.googlegroups.com>, Graham Dumpleton wrote: > On Jan 30, 9:53 am, Ron Garret wrote: > > In article <498171a5$0$3681$426a7...@news.free.fr>, > >  Bruno Desthuilliers > > > >  wrote: > &

Re: More mod_wsgi weirdness: process restarts on redirect

2009-01-29 Thread Ron Garret
In article , Joshua Kugler wrote: > Ron Garret wrote: > > My question is: is this supposed to be happening? Or is this an > > indication that something is wrong, and if so, what? > > You are probably just hitting a different instance of Apache, thus the > different

Re: More mod_wsgi weirdness: process restarts on redirect

2009-01-29 Thread Ron Garret
In article , Ron Garret wrote: > I'm running mod_wsgi under apache (on Debian etch so it's a somewhat out > of date version, though I doubt that has anything to do with this issue). > > I have a little test page that displays the process ID under which my > app is

More mod_wsgi weirdness: process restarts on redirect

2009-01-29 Thread Ron Garret
I'm running mod_wsgi under apache (on Debian etch so it's a somewhat out of date version, though I doubt that has anything to do with this issue). I have a little test page that displays the process ID under which my app is running, and some global state, so I can tell when the wsgi app gets re

Re: Sloooooowwwww WSGI restart

2009-01-29 Thread Ron Garret
In article <498170d4$0$23718$426a7...@news.free.fr>, Bruno Desthuilliers wrote: > Ron Garret a écrit : > > I'm running a WSGI app under apache/mod_wsgi and I've noticed that > > whenever I restart the server after making a code change it takes a very > >

Re: Sloooooowwwww WSGI restart

2009-01-29 Thread Ron Garret
In article <498171a5$0$3681$426a7...@news.free.fr>, Bruno Desthuilliers wrote: > Ron Garret a écrit : > > In article , > > Aleksandar Radulovic wrote: > (snip) > >> Secondly, why are you restarting apache after code changes? In normal > >> ci

Re: Sloooooowwwww WSGI restart

2009-01-28 Thread Ron Garret
In article <4cd232ff-ba8b-47aa-8ee6-d8d9712db...@s1g2000prg.googlegroups.com>, Graham Dumpleton wrote: > On Jan 29, 8:35 am, Ron Garret wrote: > > I'm running a WSGI app under apache/mod_wsgiand I've noticed that > > whenever I restart the server after makin

Re: Sloooooowwwww WSGI restart

2009-01-28 Thread Ron Garret
In article , Jean-Paul Calderone wrote: > On Wed, 28 Jan 2009 13:35:56 -0800, Ron Garret wrote: > >I'm running a WSGI app under apache/mod_wsgi and I've noticed that > >whenever I restart the server after making a code change it takes a very > >long time (like

Re: Sloooooowwwww WSGI restart

2009-01-28 Thread Ron Garret
In article , Aleksandar Radulovic wrote: > Hi there, > > On Wed, Jan 28, 2009 at 9:35 PM, Ron Garret wrote: > > I'm running a WSGI app under apache/mod_wsgi and I've noticed that > > Off the bat, there's no reason to run an app under apache/mod_wsgi &

Sloooooowwwww WSGI restart

2009-01-28 Thread Ron Garret
I'm running a WSGI app under apache/mod_wsgi and I've noticed that whenever I restart the server after making a code change it takes a very long time (like a minute) before the script is active again. In other words, I do an apachectl restart, reload the page in my browser, and one minute late

wsgi silently swallows errors

2009-01-19 Thread Ron Garret
Consider the following wsgi app: def application(env, start_response): start_response('200 OK',[('Content-type','text/plain')]) yield "hello" x=1/0 yield "world" The result of this is that the web browser displays "hello" and an error message ends up in the web log. But there is no othe

Yaro vs WebOb

2009-01-19 Thread Ron Garret
I'm selecting infrastructure for a web development and I've found two lightweight frameworks that seem to offer a lot of bang-for-the-byte: Yaro and WebOb. I'm wondering if anyone here has used either or both and has opinions about them. What has been your experience with them? Which do you

Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Ron Garret
On Jan 18, 1:21 pm, Graham Dumpleton wrote: > On Jan 19, 6:01 am, Ron Garret wrote: > > > I'm writing a WSGI application and I would like to check the content- > > length header before reading the content to make sure that the content > > is not too big in order

Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Ron Garret
On Jan 18, 12:40 pm, "Diez B. Roggisch" wrote: > Ron Garret schrieb: > > > > > On Jan 18, 11:29 am, "Diez B. Roggisch" wrote: > >> Ron Garret schrieb: > > >>> I'm writing a WSGI application and I would like to check the conten

Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Ron Garret
On Jan 18, 11:43 am, Petite Abeille wrote: > On Jan 18, 2009, at 8:01 PM, Ron Garret wrote: > > > def application(environ, start_response): > >    status = "200 OK" > >    headers = [('Content-Type', 'text/html'), ] > >    start_res

Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Ron Garret
On Jan 18, 11:29 am, "Diez B. Roggisch" wrote: > Ron Garret schrieb: > > > > > I'm writing a WSGI application and I would like to check the content- > > length header before reading the content to make sure that the content > > is not too big in orde

WSGI question: reading headers before message body has been read

2009-01-18 Thread Ron Garret
I'm writing a WSGI application and I would like to check the content- length header before reading the content to make sure that the content is not too big in order to prevent denial-of-service attacks. So I do something like this: def application(environ, start_response): status = "200 OK"

Need help getting MoinMoin to run under SCGI

2008-12-28 Thread Ron Garret
So I have a MoinMoin installation running as a cgi and also under wsgi. Since I was on a roll I decided to press my luck and try running it under scgi. Following a suggestion in the following article: http://www.linuxjournal.com/article/9310 I wrote this little server adapter: from MoinMo

Re: Need help getting MoinMoin to run under WSGI

2008-12-28 Thread Ron Garret
In article , Graham Dumpleton wrote: > On Dec 28, 7:22 pm, Ron Garret wrote: > > In article , > >  Ron Garret wrote: > > > > > > > > > I successfully installed MoinMoin as a CGI according to the instructions > > > on the moinmo.in s

Re: Need help getting MoinMoin to run under WSGI

2008-12-28 Thread Ron Garret
In article , Ron Garret wrote: > I successfully installed MoinMoin as a CGI according to the instructions > on the moinmo.in site. But when I tried to switch over to running it > under wsgi it failed thusly: > > [Sat Dec 27 21:44:14 2008] [error] [client 66.214.189.2]

Need help getting MoinMoin to run under WSGI

2008-12-27 Thread Ron Garret
I successfully installed MoinMoin as a CGI according to the instructions on the moinmo.in site. But when I tried to switch over to running it under wsgi it failed thusly: [Sat Dec 27 21:44:14 2008] [error] [client 66.214.189.2] Traceback (most recent call last): [Sat Dec 27 21:44:14 2008] [err

Re: CTypes on a 64 bit machine truncates pointers to 32 bits?

2008-09-18 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > foolib = cdll.LoadLibrary('foo.so') > foolib.foo(0xF) > > 0 > > Shouldn't you tell ctypes that the argument and the result > of foo is a pointer? Yeah... that's it. Default return type is int, whic

CTypes on a 64 bit machine truncates pointers to 32 bits?

2008-09-18 Thread Ron Garret
CTypes on a 64-bit machine appears to be truncating pointers to 32 bits: [EMAIL PROTECTED]:~]$ uname -a Linux monster1 2.6.18-6-amd64 #1 SMP Mon Jun 16 22:30:01 UTC 2008 x86_64 GNU/Linux [EMAIL PROTECTED]:~]$ cat foo.c void* foo(void* x) { return x; } [EMAIL PROTECTED]:~]$ gcc -fPIC -shared foo.c

Re: Parsing MIME-encoded data in an HTTP request

2008-07-06 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Michael Ströder <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > In article <[EMAIL PROTECTED]>, > > Ron Garret <[EMAIL PROTECTED]> wrote: > > > >> In article <[EMAIL PROTECTED]>, > >> M

Re: Parsing MIME-encoded data in an HTTP request

2008-07-04 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Ron Garret <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Michael Ströder <[EMAIL PROTECTED]> wrote: > > > Ron Garret wrote: > > > I'm writing a little HTTP server and need to parse reque

Re: Parsing MIME-encoded data in an HTTP request

2008-07-04 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Michael Ströder <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > I'm writing a little HTTP server and need to parse request content that > > is mime-encoded. All the MIME routines in the Python standard library > > see

Re: Parsing MIME-encoded data in an HTTP request

2008-07-04 Thread Ron Garret
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > On Jul 3, 3:59 pm, Ron Garret <[EMAIL PROTECTED]> wrote: > > I'm writing a little HTTP server and need to parse request content that > > is mime-encoded. All the MIME routines in the Python standa

Parsing MIME-encoded data in an HTTP request

2008-07-03 Thread Ron Garret
I'm writing a little HTTP server and need to parse request content that is mime-encoded. All the MIME routines in the Python standard library seem to have been subsumed into the email package, which makes this operation a little awkward. It seems I have to do the following: 1. Extract the co

Re: Is there a way to change the default string encoding?

2007-08-21 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Peter Otten <[EMAIL PROTECTED]> wrote: > If all else fails there's > > >>> sys.setdefaultencoding("latin1") > >>> "Andre\xe9 Ramel".decode() > u'Andre\xe9 Ramel' > > but that's an evil hack, you should rather talk to the maintainer of the > offending code to upda

Is there a way to change the default string encoding?

2007-08-20 Thread Ron Garret
Is there a way to change the default string encoding used by the string.encode() method? My default environment is utf-8 but I need it to be latin-1 to avoid errors like this: >>> 'Andr\xe9 Ramel'.decode() Traceback (most recent call last): File "", line 1, in UnicodeDecodeError: 'a

Re: Is wsgi ready for prime time?

2007-05-17 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Stargaming <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > The wsgiref module in Python 2.5 seems to be empty: > > > > [EMAIL PROTECTED]:~/Sites/modpy]$ python > > Python 2.5 (r25:51908, Mar 1 2007, 10:09:05) > >

Is wsgi ready for prime time?

2007-05-17 Thread Ron Garret
The wsgiref module in Python 2.5 seems to be empty: [EMAIL PROTECTED]:~/Sites/modpy]$ python Python 2.5 (r25:51908, Mar 1 2007, 10:09:05) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import wsgiref >>> dir(wsgi

Re: Select weirdness

2007-04-23 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Donn Cave <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Ron Garret <[EMAIL PROTECTED]> wrote: > > > The answer is obvious: select is looking only at the underlying socket, > > and not at the rfile bu

Re: Select weirdness

2007-04-23 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > Twisted does this out of the box, for what it's worth. Thanks. I will look at that. rg -- http://mail.python.org/mailman/listinfo/python-list

Re: Select weirdness

2007-04-23 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 23 Apr 2007 04:33:22 -0300, Ron Garret <[EMAIL PROTECTED]> > escribió: > > > I have not been able to find a proxy server that can proxy to unix > > socket

Re: Select weirdness

2007-04-23 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Irmen de Jong <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > I don't understand why socketserver calling select should matter. (And > > BTW, there are no calls to select in SocketServer.py. I'm using > > Python

Re: Bug in select (was: Re: Select weirdness)

2007-04-22 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > Well, on WinXP, Python 2.4, with I should have specified: I'm running 2.5 on unix. (I've reproduced the problem on both Linux and OS X.) rg -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug in select

2007-04-22 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Erik Max Francis <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > > Geez you people are picky. Since I ran this several times I ran into > > the TIM_WAIT problem. Here's the actual transcript: > > It's not abou

Re: Bug in select

2007-04-22 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Erik Max Francis <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > > So this is clearly a bug, but surely I'm not the first person to have > > encountered this? Is there a known workaround? > > It's hard to see

Bug in select (was: Re: Select weirdness)

2007-04-22 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Ron Garret <[EMAIL PROTECTED]> wrote: > The answer is obvious: select is looking only at the underlying socket, > and not at the rfile buffers. Here is conclusive proof that there's a bug in select: from socket import * from select

Re: Select weirdness

2007-04-22 Thread Ron Garret
I think I've figured out what's going on. First, here's the smoking gun: I changed the code as follows: class myHandler(StreamRequestHandler): def handle(self): print '>>>' while 1: sl = select([self.rfile],[],[],1)[0] print sl l = self.rfile.readline() i

Re: Select weirdness

2007-04-22 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Ron Garret <[EMAIL PROTECTED]> wrote: > Here's my code. It's a teeny weeny little HTTP server. (I'm not really > trying to reinvent the wheel here. What I'm really doing is writing a > dispatching proxy server, but t

Re: Select weirdness

2007-04-22 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Irmen de Jong <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > Here's my code. It's a teeny weeny little HTTP server. (I'm not really > > trying to reinvent the wheel here. What I'm really doing is writing a

Re: Select weirdness

2007-04-22 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Bjoern Schliessmann <[EMAIL PROTECTED]> wrote: > > The only difference I can discern is that the browser send \r\n > > for end-of-line while telnet just sends \n. ... > > But I don't see why that should make any difference. > > Easy. If you only accept "\r\n

Select weirdness

2007-04-21 Thread Ron Garret
Here's my code. It's a teeny weeny little HTTP server. (I'm not really trying to reinvent the wheel here. What I'm really doing is writing a dispatching proxy server, but this is the shortest way to illustrate the problem I'm having): from SocketServer import * from socket import * from sele

Re: BaseHTTPServer and Apache

2007-04-14 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Luis M. González" <[EMAIL PROTECTED]> wrote: > On Apr 13, 8:44 pm, Ron Garret <[EMAIL PROTECTED]> wrote: > > In article <[EMAIL PROTECTED]>, > > Ron Garret <[EMAIL PROTECTED]> wrote: > > > >

Re: BaseHTTPServer and Apache

2007-04-13 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Ron Garret <[EMAIL PROTECTED]> wrote: > Does > anyone know of a straightforward way to get Apache to "forward" requests > to a given path to another HTTP server running on a different port? Never mind, I think I figured it out.

BaseHTTPServer and Apache

2007-04-13 Thread Ron Garret
I have a fairly large web app written in Python as a CGI fairly elaborate CGI. All of the requests go through a single CGI script which does authentication and session management and then dispatches to one of a number of handlers that generate the various pages. There is one page that is a per

Re: Python on a mac: how to build pythonw?

2007-03-01 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Robert Kern <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > In article <[EMAIL PROTECTED]>, > > Robert Kern <[EMAIL PROTECTED]> wrote: > > >> Note that in recent versions of Python, I believe that the pythonw

Re: Python on a mac: how to build pythonw?

2007-03-01 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Robert Kern <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > I'm trying to run the Python examples distributed with XCode and they > > all give me the same error: > > > > Traceback (most recent call last): > >

Python on a mac: how to build pythonw?

2007-03-01 Thread Ron Garret
I'm trying to run the Python examples distributed with XCode and they all give me the same error: Traceback (most recent call last): File "checktext.py", line 35, in main() File "checktext.py", line 8, in main pathname = EasyDialogs.AskFileForOpen(message='File to check end-of-lines

Re: Python, readline and OS X

2007-02-01 Thread Ron Garret
In article <[EMAIL PROTECTED]>, James Stroud <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > In article <[EMAIL PROTECTED]>, > > James Stroud <[EMAIL PROTECTED]> wrote: > > > >>Is LD_LIBRARY_PATH pointing to the directory libreadline.dyl

Re: Python, readline and OS X

2007-02-01 Thread Ron Garret
In article <[EMAIL PROTECTED]>, James Stroud <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > I have installed Python 2.5 on my new Intel Mac but I can't for the life > > of me get readline to work. I have libreadline installed, I've tried >

Re: Python, readline and OS X

2007-02-01 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Irmen de Jong <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > I have installed Python 2.5 on my new Intel Mac but I can't for the life > > of me get readline to work. I have libreadline installed, I've tried >

Python, readline and OS X

2007-02-01 Thread Ron Garret
I have installed Python 2.5 on my new Intel Mac but I can't for the life of me get readline to work. I have libreadline installed, I've tried copying readline.so from my Python 2.3 installation into 2.5, I've searched the web, and no joy. Could someone please give me a clue? rg -- http://mai

Re: Is there a reason not to do this?

2006-12-01 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Michele Simionato" <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > One of the things I find annoying about Python is that when you make a > > change to a method definition that change is not reflected in existing > >

Re: Is there a reason not to do this?

2006-12-01 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Carl Banks" <[EMAIL PROTECTED]> wrote: > The principle behind this is pretty much "it was just a language design > decision". Yes, and I'm not taking issue with the decision, just pointing out that the desire to do things differently is not necessarily perverse.

Re: Functions, callable objects, and bound/unbound methods

2006-12-01 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Michele Simionato" <[EMAIL PROTECTED]> wrote: > Duncan Booth wrote: > > Ron Garret <[EMAIL PROTECTED]> wrote: > > > > > I want to say: > > > > > > trace(c1.m1) > > > > > > an

Re: Functions, callable objects, and bound/unbound methods

2006-12-01 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Kent Johnson <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > The reason I want to do this is that I want to implement a trace > > facility that traces only specific class methods. I want to say: > > > > trace(c1.m1) >

Functions, callable objects, and bound/unbound methods

2006-12-01 Thread Ron Garret
If I do this: def f(self): print self class c1: pass setattr(c1, 'm1', f) Then f is automagically transmogrified into the appropriate sort of method depending on how it is used: >>> c1.m1 >>> c1().m1 > >>> c1().m1() <__main__.c1 instance at 0x51ec60> Note that m1 gets passed a self argument

Re: Is there a reason not to do this?

2006-11-30 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Paul McGuire" <[EMAIL PROTECTED]> wrote: > "Carl Banks" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > > A straightforward, Pythonic way to do it would be to create an > > intermediate representation that understands both the existing class >

Re: Is there a reason not to do this?

2006-11-30 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Ron Garret <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > > > "Ron Garret" <[EMAIL PROTECTED]> wrote: > > > > >

Re: Is there a reason not to do this?

2006-11-30 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > "Ron Garret" <[EMAIL PROTECTED]> wrote: > > > > > > One of the things I find annoying about Python is that when you make a > > change to a method

Re: Is there a reason not to do this?

2006-11-30 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Ron Garret schrieb: > > One of the things I find annoying about Python is that when you make a > > change to a method definition that change is not reflected in existing >

Is there a reason not to do this?

2006-11-30 Thread Ron Garret
One of the things I find annoying about Python is that when you make a change to a method definition that change is not reflected in existing instances of a class (because you're really defining a new class when you reload a class definition, not actually redefining it). So I came up with thi

Re: Why doesn't this work?

2006-10-21 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Larry Bates <[EMAIL PROTECTED]> wrote: > Because datetime is a new-style class: Ah. > The Constructor __new__ > > If you are like me, then you probably always thought of the __init__ method > as > the Python equivalent of what is called a constructor in C++. Th

Why doesn't this work?

2006-10-21 Thread Ron Garret
Python 2.3.5 (#1, Jan 30 2006, 13:30:29) [GCC 3.3 20030304 (Apple Computer, Inc. build 1819)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from datetime import datetime >>> class ts(datetime): ... def __init__(self): pass ... >>> ts() Traceback (most rece

Re: BaseHTTPServer weirdness

2006-09-12 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > I wouldn't necessarily say you are wrong here, It's just that the cgi > module has sort of "just growed", so it isn't conveniently factyored for > reusability in other contexts. Several people (including me) have taken >

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Damjan <[EMAIL PROTECTED]> wrote: > >> But basically, you aren't providing a CGI environment, and that's why > >> cgi.parse() isn't working. > > > > Clearly. So what should I be doing? > > Probably you'll need to read the source of cgi.parse_qs (like Steve did)

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Kent Johnson <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: > > Ron Garret wrote: > >> In article <[EMAIL PROTECTED]>, > >> Steve Holden <[EMAIL PROTECTED]> wrote: > >> > >> > &

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > In article <[EMAIL PROTECTED]>, > > Steve Holden <[EMAIL PROTECTED]> wrote: > > > > > >>But basically, you aren't providing

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > But basically, you aren't providing a CGI environment, and that's why > cgi.parse() isn't working. Clearly. So what should I be doing? Surely I'm not the first person to have this problem? I have managed to work aroun

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > The normal way is > > s = cgi.parse() > > since the CGI script sees the client network socket (after consumption > of HTTP headers) as its standard input. Doesn't work. (I even tried sys.stdin=r.rfile; s=cgi.parse())

BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
I'm trying to figure out how to use BaseHTTPServer. Here's my little test app: = #!/usr/bin/python from BaseHTTPServer import * import cgi class myHandler(BaseHTTPRequestHandler): def do_GET(r): s = '' try: s = cgi.parse_qs(r.rfile.read(int(r.

Parsing form input in a BaseHTTPServer

2006-09-01 Thread Ron Garret
I'm write a web server using BaseHTTPServer. It can't be a CGI because it has to do some weird server-push stuff as database updates come in. But I still need to process form inputs as if it were a CGI. But the cgi module only works in a CGI environment. Is there something with the equivale

Re: What is Expressiveness in a Computer Language

2006-06-19 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Marshall" <[EMAIL PROTECTED]> wrote: > The conversation I would *really* like to have is the one where we > discuss what all the differences are, functionally, between the two, > and what the implications of those differences are, without trying > to address which

Re: WTF? Printing unicode strings

2006-05-19 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Serge Orlov" <[EMAIL PROTECTED]> wrote: > Serge Orlov wrote: > > Ron Garret wrote: > > > In article <[EMAIL PROTECTED]>, > > > "Serge Orlov" <[EMAIL PROTECTED]> wrote: > > > >

Re: WTF? Printing unicode strings

2006-05-19 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Serge Orlov" <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > In article <[EMAIL PROTECTED]>, > > "Serge Orlov" <[EMAIL PROTECTED]> wrote: > > > > > Ron Garret wrote: > > >

  1   2   >