Re: Module loading trickery

2010-10-05 Thread Jonas Galvez
Thanks a million, runpy is exactly what I was looking for! I will send you a link to what I'm using it for when it's done. Then you'll understand ;) -- Jonas On Tue, Oct 5, 2010 at 1:06 PM, Thomas Jollans wrote: > On Tuesday 05 October 2010, it occurred to Jonas Galvez

Module loading trickery

2010-10-05 Thread Jonas Galvez
Is there a way to "inject" something into a module right before it's loaded? For instance, a.py defines "foo". b.py print()s "foo". I want to load b.py into a.py, but I need to let b.py know about "foo" before it can execute. Is this any way to achieve this? -- Jonas -- http://mail.python.org/

Re: Python2.7 on OSX

2010-09-26 Thread Jonas Galvez
Bingo, that was it. Thanks! -- Jonas On Sat, Sep 25, 2010 at 4:05 PM, Shashwat Anand wrote: > > > On Sun, Sep 26, 2010 at 12:32 AM, Jonas Galvez wrote: > >> Just installed Python2.7 on my OSX Leopard with make altinstall. >> >> No missing dependencies, but I

Python2.7 on OSX

2010-09-25 Thread Jonas Galvez
Just installed Python2.7 on my OSX Leopard with make altinstall. No missing dependencies, but I have one annoying problem: the delete key prints '^H' on the Python shell. Does anyone know how to fix that? Thanks in advance, -- Jonas -- http://mail.python.org/mailman/listinfo/python-list

Re: HTTP request error with urlopen

2008-07-03 Thread Jonas Galvez
) file_source=open("google_source.txt", 'w') file_source.write(urllib2.urlopen(req).read()) file_source.close() I think Google blocks the User-Agent urllib2 sends. --Jonas Galvez, http://jonasgalvez.com.br/log On Thu, Jul 3, 2008 at 3:52 AM, spandana g <[EMAIL PROTECTED]> wrote: > He

Re: ANN: XML builder for Python

2008-07-03 Thread Jonas Galvez
as suggested previously might be a good solution if you want to preserve what you've generated, tho. --Jonas Galvez -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: XML builder for Python

2008-07-03 Thread Jonas Galvez
aving other child elements. I believe my xmlbuilder will work well for Atom, XML-RPC, SOAP etc, but definitely not for HTML! :) Overriding + is a rather clever way to prevent this (so you can actually know you're calling it inline), but I don't really see a need for it for most things XML. --Jonas Galvez, http://jonasgalvez.com.br/log -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: XML builder for Python

2008-07-03 Thread Jonas Galvez
as simple as possible, so I wouldn't even have to assign a variable on the with block ("as something"). I plan to add some validation and error checking, but for generating feeds for my Atom store it's reasonably fast and lean (just over 50 lines of code). --Jonas

ANN: XML builder for Python

2008-07-02 Thread Jonas Galvez
03"; /> urn:uuid:1225c695-cfb8-4ebb--80da344efa6a 2003-12-13T18:30:02Z Some text. http://github.com/galvez/gae-rest/tree/258066f5e1a32c999e04a9313943fdfa8e64edd9/xmlbuilder.py --Jonas Galvez -- http://mail.python.org/mailman/listinfo/python-list

Strange urllib.unquote() behavior

2008-06-26 Thread Jonas Galvez
n a Google App Engine request handler. So right now I have to apply unquote() twice in order to get the correct result. Any clue much appreciated. --Jonas Galvez -- http://mail.python.org/mailman/listinfo/python-list

Re: What YAML engine do you use?

2005-01-20 Thread Jonas Galvez
Diez B. Roggisch wrote: > I first used yaml, tried to migrate to syck. What I like about > syck is that it is faster and doesn't try to create objects but > only dicts - but it crashed if the number of yaml objects grew > larger. So I still use yaml. Hmm.. I've never had any problems with syck.

Re: python3: 'where' keyword

2005-01-10 Thread Jonas Galvez
Andrey Tatarinov wrote: > It would be great to be able to reverse usage/definition parts > in haskell-way with "where" keyword. Hi folks, I really like this idea. But I couldn't help but think of a few alternative ways. I'm no language design expert by any means, but I'm a little concerned with

Re: HTTP GET request with basic authorization?

2005-01-02 Thread Jonas Galvez
Christopher J. wrote: > I tried this, but it didn't work: > conn.request("GET", "/somepage.html", None, > {"AUTHORIZATION": "Basic username:password"}) Hmm, try this: import re, base64 userpass = base64.encodestring('user:pass').replace('\n', '') authd = {'Authorization':'Basic %s' % userpass} c

HTTP response code

2004-12-03 Thread Jonas Galvez
Hi list, here's a question about urllib. Is it possible to simply retrieve the HTTP responde code for a given URL? I don't want to download the body of the HTTP message. I simply want to check the response code, like, if it is 200, 301 etc. Something like: if urllib.urlopen(the_url).response_co

Re: debian python2.4

2004-12-02 Thread Jonas Galvez
km wrote: > is there a debian binary of python2.4 ? Not yet, I guess, but I could easily compile it from the source (I'm no Linux expert, I simply followed the instructions: ./configure, make, make install, and voilĂ ). No error messages, no nothing. Only downside is that /usr/bin/python still poin