Package data distribution and installation

2010-10-17 Thread Alejandro Dubrovsky
I've got a script that is an executable and it reads template files that should be packaged with the script. How do I tell the script where to find the templates? In distutils, there's a package_data option, but that installs the templates under the /usr/lib/pythonX.XX/... directory, which se

exec and closures

2008-02-21 Thread Alejandro Dubrovsky
About a month ago, there was a thread on auto-assigning decorators for __init__. One by André Roberge is here: http://groups.google.com/group/comp.lang.python/browse_frm/ thread/32b421bbe6caaeed/0bcd17b1fa4fb07c?#0bcd17b1fa4fb07c This works well for simple cases, but doesn't take keyword argumen

Re: Regex Speed

2007-02-20 Thread Alejandro Dubrovsky
Steve Holden wrote: > John Machin wrote: > [...] >> >> To help you, we need either (a) basic information or (b) crystal >> balls. > [...] > > How on earth would having glass testicles help us help him? > John, of course, meant spheres of doped single crystal silicon on which we could simulate

Re: Regex Speed

2007-02-20 Thread Alejandro Dubrovsky
[EMAIL PROTECTED] wrote: > While creating a log parser for fairly large logs, we have run into an > issue where the time to process was relatively unacceptable (upwards > of 5 minutes for 1-2 million lines of logs). In contrast, using the > Linux tool grep would complete the same search in a matte

Re: "Correct" db adapter

2007-02-01 Thread Alejandro Dubrovsky
Bruno Desthuilliers wrote: > king kikapu a écrit : >> Thanks for the replies. >> >> I think i do not need something like ORM, but just a db-module that i >> can "work" the database with it. > > FWIW, SQLAlchemy is not an ORM, but an higher-level API for SQL > integration. The ORM part is an opti

Re: How can I write code using FP

2007-01-16 Thread Alejandro Dubrovsky
kernel1983 wrote: > In Function Program?Language can use like this: > > define a function: > f = lambda x,y:x,y > > then we use f to define another function: > f2 = f(1) > the f2 should equal to: > f2=lambda y:1,y > > we should be able call f2 with one parameter:f2(2) > just return 1,2 > > but

Re: urllib2 through basic auth'ed proxy

2006-04-02 Thread Alejandro Dubrovsky
John J. Lee wrote: > [EMAIL PROTECTED] (John J. Lee) writes: > >> Alejandro Dubrovsky <[EMAIL PROTECTED]> writes: > [...Alejandro complains about non-working HTTP proxy auth in urllib2...] > > [...John notes urllib2 bug...] >> A workaround is to supply a s

Re: urllib2 through basic auth'ed proxy

2006-03-30 Thread Alejandro Dubrovsky
John J. Lee wrote: > FWIW, at a glance, Python 2.3.4 has neither of the bugs I mentioned, > but the code I posted seems to work with 2.3.4. I'm not particularly > interested in what's wrong with 2.3.4's version or your usage of it > (probably both), since bugfix releases for 2.3 are no longer > h

urllib2 through basic auth'ed proxy

2006-03-29 Thread Alejandro Dubrovsky
I see from googling around that this is a popular topic, but I haven't seen anyone saying "ah, yes, that works", so here it goes. How does one connect through a proxy which requires basic authorisation? The following code, stolen from somewhere, fails with a 407: proxy_handler = urllib2.ProxyHand