Sunday, March 7, 2010

comp.lang.python - 17 new messages in 8 topics - digest

comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en

comp.lang.python@googlegroups.com

Today's topics:

* Sample code usable Tkinter listbox - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/bd27ec170800827f?hl=en
* Conditional based on whether or not a module is being used - 1 messages, 1
author
http://groups.google.com/group/comp.lang.python/t/ee22c223fa73a429?hl=en
* python b.python 8 works on XP but not on Vista? - 9 messages, 4 authors
http://groups.google.com/group/comp.lang.python/t/7b40d624bf879b9f?hl=en
* async notification handling w/o threads/polling (similiar to kill -hup)? - 2
messages, 1 author
http://groups.google.com/group/comp.lang.python/t/a0e5a974642d0445?hl=en
* indentation error - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/c0fcd040bcecfca0?hl=en
* _winreg and access registry settings of another user - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/52d636db0efe185d?hl=en
* yappi v0.42 released - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/aff789edafee65f5?hl=en
* Asynchronous HTTP client - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/8d12ca848ffb171e?hl=en

==============================================================================
TOPIC: Sample code usable Tkinter listbox
http://groups.google.com/group/comp.lang.python/t/bd27ec170800827f?hl=en
==============================================================================

== 1 of 1 ==
Date: Sat, Mar 6 2010 2:46 pm
From: rantingrick


Opps: found a few errors in that last ScrolledListbox class, try this
one...

import Tkinter as tk
from Tkconstants import *

class ScrolledList(tk.Listbox):
def __init__(self, master, **kw):
self.frame = tk.Frame(master)
self.frame.rowconfigure(0, weight=1)
self.frame.columnconfigure(0, weight=1)
self.hbar = tk.Scrollbar(self.frame, orient=HORIZONTAL)
self.block = tk.Frame(self.frame, width=18, height=18)
self.block.grid(row=1, column=1)
self.vbar = tk.Scrollbar(self.frame, orient=VERTICAL)
kw.setdefault('activestyle', 'none')
kw.setdefault('highlightthickness', 0)
kw.setdefault('pack', 0)
if kw.pop('pack') == 1:
self.frame.pack(fill=BOTH, expand=1)
tk.Listbox.__init__(self, self.frame, **kw)
self.grid(row=0, column=0, sticky=N+S+E+W)
self.hbar.configure(command=self.xview)
self.vbar.configure(command=self.yview)
self.config(
yscrollcommand=self.vbar.set,
xscrollcommand=self.hbar.set
)
self.hbar.grid(row=1, column=0, sticky=W+E)
self.vbar.grid(row=0, column=1, sticky=N+S)

self.pack = lambda **kw: self.frame.pack(**kw)
self.grid = lambda **kw: self.frame.grid(**kw)
self.place = lambda **kw: self.frame.place(**kw)
self.pack_config = lambda **kw: self.frame.pack_config(**kw)
self.grid_config = lambda **kw: self.frame.grid_config(**kw)
self.place_config = lambda **kw: self.frame.place_config(**kw)
self.pack_configure = lambda **kw:
self.frame.pack_config(**kw)
self.grid_configure = lambda **kw:
self.frame.grid_config(**kw)
self.place_configure = lambda **kw:
self.frame.place_config(**kw)

def gets(self):
return self.get(0, END)

def sets(self, arg):
self.delete(0, END)
try:
arg = arg.strip('\n').splitlines()
except AttributeError:
pass
if hasattr(arg, '__getitem__'):
for item in arg:
self.insert(END, str(item))
else:
raise TypeError("Scrolledlist.sets() requires a string or
iterable of strings")


if __name__ == '__main__':
root = tk.Tk()
listbox = ScrolledList(root, width=50, height=10, pack=1)
#listbox.sets(1.25)
#listbox.sets('1\n2\n3\n4\n5\n\n\n')
listbox.sets(range(100))
#listbox.grid(row=0, column=0)
root.mainloop()

==============================================================================
TOPIC: Conditional based on whether or not a module is being used
http://groups.google.com/group/comp.lang.python/t/ee22c223fa73a429?hl=en
==============================================================================

== 1 of 1 ==
Date: Sat, Mar 6 2010 3:13 pm
From: Pete Emerson


On Mar 6, 2:38 pm, Vinay Sajip <vinay_sa...@yahoo.co.uk> wrote:
> On Mar 5, 9:29 pm, Pete Emerson <pemer...@gmail.com> wrote:
>
>
>
> > I have written my first module called "logger" that logs to syslog via
> > the syslog module but also allows forloggingto STDOUT in debug mode
> > at multiple levels (to increase verbosity depending on one's need), or
> > both. I've looked at theloggingmodule and while it might suit my
> > needs, it's overkill for me right now (I'm still *very* much a python
> > newbie).
>
> Overkill in what sense? You just need to write a few lines of code to
> be able to use the logging package which comes with Python:
>
> import logging, logging.handlers, sys
> logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)
> logging.getLogger().addHandler(logging.handlers.SysLogHandler())
> # default logs to syslog at (localhost, 514) with facility LOG_USER
> # you can change the default to use e.g. Unix domain sockets and a
> different facility
>
> So you're experienced enough and have time enough to write your own
> logger module, but too much of a newbie to use a module which is part
> of Python's included batteries? If you're writing something like
> logging to learn about it and what the issues are, that's fair enough.
> But I can't see what you mean by overkill, exactly. The three lines
> above (or thereabouts) will, I believe, let you log to syslog and to
> stdout...which is what you say you want to do.
>
> > I want to write other modules, and my thinking is that it makes sense
> > for those modules to use the "logger" module to do thelogging, if and
> > only if the parent using the other modules is also using the logger
> > module.
>
> > In other words, I don't want to force someone to use the "logger"
> > module just so they can use my other modules, even if the "logger"
> > module is installed ... but I also want to take advantage of it if I'm
> > using it.
>
> > Now that I've written that, I'm not sure that makes a whole lot of
> > sense. It seems like I could say, "hey, this person has the 'logger'
> > module available, let's use it!".
>
> > Thoughts?
>
> Well, the logging package is available in Python and ready for use and
> pretty much battle tested, so why not use that? Are you planning to
> use third-party libraries in your Python work, or write everything
> yourself? If you are planning to use third party libraries, how would
> their logging be hooked into your logger module? And if not, is it
> good to have two logging systems in parallel?
>
> Of course as the maintainer of Python's logging package, you'd expect
> me to be biased in favour of it. You maybe shouldn't let that sway
> you ;-)
>
> Regards,
>
> Vinay Sajip

Thanks for your insights, Vinay, and thank you also for writing
packages such as logging. The word 'overkill' was a poor choice on my
part! I should have said, "I don't quite understand the logging module
yet, but I am comfortable with the syslog module's two functions,
openlog and syslog".

I wrote my own logger module *partly* to gain the experience, and
partly to do the following:

1) In debug mode, send what would have gone to syslog to STDOUT or
STDERR
2) In non-debug mode, use /dev/log or localhost:514 depending on what
is set
3) Allow for multiple levels of logging beyond INFO, WARNING, CRIT ...
essentially allow multiple levels of INFO depending on how much detail
is desired. A high level of messaging when programs are running
poorly is desired, but when programs are running smoothly, I don't
need to send as much to syslog.

I started in with your logging package, but I think I simply got ahead
of myself. I definitely agree that writing my own wrappers around
syslog to do what I want might be a duplication of effort. At this
point I think I'm ready to go back to your logging package and see
what I can do; if you have words of advice regarding 1-3 above, I'd
certainly appreciate it.

Now I'll go to your example above and see what it does. Thank you!

Pete

==============================================================================
TOPIC: python b.python 8 works on XP but not on Vista?
http://groups.google.com/group/comp.lang.python/t/7b40d624bf879b9f?hl=en
==============================================================================

== 1 of 9 ==
Date: Sat, Mar 6 2010 3:53 pm
From: Isaac Gouy


At the command prompt:

python b.py 8
works fine on both XP and Vista

python b.python 8
works on XP (and Linux)

but on Vista

python b.python 8

ImportError: No module named b

?


== 2 of 9 ==
Date: Sat, Mar 6 2010 4:02 pm
From: Chris Rebert


On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy <igouy2@yahoo.com> wrote:
> At the command prompt:
>
>   python b.py 8
> works fine on both XP and Vista
>
>   python b.python 8
> works on XP (and Linux)
>
> but on Vista
>
>   python b.python 8
>
> ImportError: No module named b
>
> ?

Code please. Also, .python is not a standard extension for Python
files, so why are you using it anyway?

Cheers,
Chris
--
http://blog.rebertia.com


== 3 of 9 ==
Date: Sat, Mar 6 2010 4:42 pm
From: Isaac Gouy


On Mar 6, 4:02 pm, Chris Rebert <c...@rebertia.com> wrote:
> On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy <igo...@yahoo.com> wrote:
> > At the command prompt:
>
> >   python b.py 8
> > works fine on both XP and Vista
>
> >   python b.python 8
> > works on XP (and Linux)
>
> > but on Vista
>
> >   python b.python 8
>
> > ImportError: No module named b
>
> > ?
>
> Code please.


It's the same code in both cases, I simply renamed "b.python" as
"b.py" as a test.


> Also, .python is not a standard extension for Python
> files, so why are you using it anyway?

Because it's useful for what I'm doing.

Given python 2.6.4 has no problem with a non-standard extension on MS
XP and Linux - why does python 2.6.4 have this problem with a non-
standard extension on MS Vista?


== 4 of 9 ==
Date: Sat, Mar 6 2010 4:53 pm
From: Chris Rebert


On Sat, Mar 6, 2010 at 4:42 PM, Isaac Gouy <igouy2@yahoo.com> wrote:
> On Mar 6, 4:02 pm, Chris Rebert <c...@rebertia.com> wrote:
>> On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy <igo...@yahoo.com> wrote:
>> > At the command prompt:
>>
>> >   python b.py 8
>> > works fine on both XP and Vista
>>
>> >   python b.python 8
>> > works on XP (and Linux)
>>
>> > but on Vista
>>
>> >   python b.python 8
>>
>> > ImportError: No module named b
>>
>> > ?
>>
>> Code please.
>
>
> It's the same code in both cases, I simply renamed "b.python" as
> "b.py" as a test.

The code in b.py matters. I /suspect/ it's importing itself somehow
(probably indirectly), and Python doesn't look for ".python" files
when importing, so it fails with an ImportError. But since you haven't
shown the code, I can only guess.

For that matter, the full exception Traceback would be more helpful
than the code; please include it as well.

Cheers,
Chris
--
http://blog.rebertia.com


== 5 of 9 ==
Date: Sat, Mar 6 2010 5:23 pm
From: Isaac Gouy


On Mar 6, 4:53 pm, Chris Rebert <c...@rebertia.com> wrote:
> On Sat, Mar 6, 2010 at 4:42 PM, Isaac Gouy <igo...@yahoo.com> wrote:
> > On Mar 6, 4:02 pm, Chris Rebert <c...@rebertia.com> wrote:
> >> On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy <igo...@yahoo.com> wrote:
> >> > At the command prompt:
>
> >> >   python b.py 8
> >> > works fine on both XP and Vista
>
> >> >   python b.python 8
> >> > works on XP (and Linux)
>
> >> > but on Vista
>
> >> >   python b.python 8
>
> >> > ImportError: No module named b
>
> >> > ?
>
> >> Code please.
>
> > It's the same code in both cases, I simply renamed "b.python" as
> > "b.py" as a test.
>
> The code in b.py matters. I /suspect/ it's importing itself somehow
> (probably indirectly), and Python doesn't look for ".python" files
> when importing, so it fails with an ImportError. But since you haven't
> shown the code, I can only guess.

Yes the code in b.py matters.

Why it matters is that there was another difference between XP and
Vista - the XP machine was single core but the Vista machine was multi
core - and the code behaves differently in each case.

Thanks.

== 6 of 9 ==
Date: Sat, Mar 6 2010 6:10 pm
From: "ssteinerX@gmail.com"

On Mar 6, 2010, at 8:23 PM, Isaac Gouy wrote:

> On Mar 6, 4:53 pm, Chris Rebert <c...@rebertia.com> wrote:
>> On Sat, Mar 6, 2010 at 4:42 PM, Isaac Gouy <igo...@yahoo.com> wrote:
>>> On Mar 6, 4:02 pm, Chris Rebert <c...@rebertia.com> wrote:
>>>> On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy <igo...@yahoo.com> wrote:
>>>>> At the command prompt:
>>
>>>>> python b.py 8
>>>>> works fine on both XP and Vista
>>
>>>>> python b.python 8
>>>>> works on XP (and Linux)
>>
>>>>> but on Vista
>>
>>>>> python b.python 8
>>
>>>>> ImportError: No module named b
>>
>>>>> ?
>>
>>>> Code please.
>>
>>> It's the same code in both cases, I simply renamed "b.python" as
>>> "b.py" as a test.
>>
>> The code in b.py matters. I /suspect/ it's importing itself somehow
>> (probably indirectly), and Python doesn't look for ".python" files
>> when importing, so it fails with an ImportError. But since you haven't
>> shown the code, I can only guess.
>
> Yes the code in b.py matters.
>
> Why it matters is that there was another difference between XP and
> Vista - the XP machine was single core but the Vista machine was multi
> core - and the code behaves differently in each case.

Yes, and the XP machine's case was blue, therefore case color is important, too.

S

== 7 of 9 ==
Date: Sat, Mar 6 2010 6:50 pm
From: Steven D'Aprano


On Sat, 06 Mar 2010 21:10:02 -0500, ssteinerX@gmail.com wrote:

> On Mar 6, 2010, at 8:23 PM, Isaac Gouy wrote:
>
>> On Mar 6, 4:53 pm, Chris Rebert <c...@rebertia.com> wrote:
>>> On Sat, Mar 6, 2010 at 4:42 PM, Isaac Gouy <igo...@yahoo.com> wrote:
>>>> On Mar 6, 4:02 pm, Chris Rebert <c...@rebertia.com> wrote:
>>>>> On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy <igo...@yahoo.com> wrote:
>>>>>> At the command prompt:
>>>
>>>>>> python b.py 8
>>>>>> works fine on both XP and Vista
>>>
>>>>>> python b.python 8
>>>>>> works on XP (and Linux)
>>>
>>>>>> but on Vista
>>>
>>>>>> python b.python 8
>>>
>>>>>> ImportError: No module named b
>>>
>>>>>> ?
>>>
>>>>> Code please.
>>>
>>>> It's the same code in both cases, I simply renamed "b.python" as
>>>> "b.py" as a test.
>>>
>>> The code in b.py matters. I /suspect/ it's importing itself somehow
>>> (probably indirectly), and Python doesn't look for ".python" files
>>> when importing, so it fails with an ImportError. But since you haven't
>>> shown the code, I can only guess.
>>
>> Yes the code in b.py matters.
>>
>> Why it matters is that there was another difference between XP and
>> Vista - the XP machine was single core but the Vista machine was multi
>> core - and the code behaves differently in each case.
>
> Yes, and the XP machine's case was blue, therefore case color is
> important, too.


Don't forget that the XP machine was on the left hand side of the desk,
and the Vista machine on the right. I suspect Isaac needs to physically
move the Vista machine to the left side, and it will work perfectly.

Either that, or stop pissing around and show us the actual stack trace so
we can actually help. Isaac, stop *guessing* what the problem is.

If you have to guess, try to make your guesses realistic. It's not likely
anything to do with the CPU. If anything, Python's search path is
different on your Vista and XP machines.


--
Steven


== 8 of 9 ==
Date: Sat, Mar 6 2010 7:04 pm
From: Isaac Gouy


On Mar 6, 6:50 pm, Steven D'Aprano <st...@REMOVE-THIS-
cybersource.com.au> wrote:
> On Sat, 06 Mar 2010 21:10:02 -0500, sstein...@gmail.com wrote:
> > On Mar 6, 2010, at 8:23 PM, Isaac Gouy wrote:
>
> >> On Mar 6, 4:53 pm, Chris Rebert <c...@rebertia.com> wrote:
> >>> On Sat, Mar 6, 2010 at 4:42 PM, Isaac Gouy <igo...@yahoo.com> wrote:
> >>>> On Mar 6, 4:02 pm, Chris Rebert <c...@rebertia.com> wrote:
> >>>>> On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy <igo...@yahoo.com> wrote:
> >>>>>> At the command prompt:
>
> >>>>>>   python b.py 8
> >>>>>> works fine on both XP and Vista
>
> >>>>>>   python b.python 8
> >>>>>> works on XP (and Linux)
>
> >>>>>> but on Vista
>
> >>>>>>   python b.python 8
>
> >>>>>> ImportError: No module named b
>
> >>>>>> ?
>
> >>>>> Code please.
>
> >>>> It's the same code in both cases, I simply renamed "b.python" as
> >>>> "b.py" as a test.
>
> >>> The code in b.py matters. I /suspect/ it's importing itself somehow
> >>> (probably indirectly), and Python doesn't look for ".python" files
> >>> when importing, so it fails with an ImportError. But since you haven't
> >>> shown the code, I can only guess.
>
> >> Yes the code in b.py matters.
>
> >> Why it matters is that there was another difference between XP and
> >> Vista - the XP machine was single core but the Vista machine was multi
> >> core - and the code behaves differently in each case.
>
> > Yes, and the XP machine's case was blue, therefore case color is
> > important, too.
>
> Don't forget that the XP machine was on the left hand side of the desk,
> and the Vista machine on the right. I suspect Isaac needs to physically
> move the Vista machine to the left side, and it will work perfectly.
>
> Either that, or stop pissing around and show us the actual stack trace so
> we can actually help. Isaac, stop *guessing* what the problem is.
>
> If you have to guess, try to make your guesses realistic. It's not likely
> anything to do with the CPU. If anything, Python's search path is
> different on your Vista and XP machines.
>
> --
> Steven


That was "Thanks." as in problem solved.

When the code switches on multiprocessing.cpu_count() - single core vs
multicore matters.


== 9 of 9 ==
Date: Sat, Mar 6 2010 8:23 pm
From: Steven D'Aprano


On Sat, 06 Mar 2010 19:04:56 -0800, Isaac Gouy wrote:

> That was "Thanks." as in problem solved.
>
> When the code switches on multiprocessing.cpu_count() - single core vs
> multicore matters.

I'm glad you solved your problem. Out of curiosity, what was the fault?
Not the condition that leads to the fault, but the actual fault?

My guess is that it was a difference in sys.path, leading to the b module
not being found. Am I close?


--
Steven

==============================================================================
TOPIC: async notification handling w/o threads/polling (similiar to kill -hup)?

http://groups.google.com/group/comp.lang.python/t/a0e5a974642d0445?hl=en
==============================================================================

== 1 of 2 ==
Date: Sat, Mar 6 2010 3:53 pm
From: News123


Hi,

I'd like to notify python processes asynchronously.
at notification time a callback should be called

The solution should be working on linux and Windows.

I could add a wrapper to switch between a windows / linux implementation
though

If possible I'd like to avoid
- having to poll for an external event
- having to add a thread.
- changing my existing code

I thought about using signal and os.kill()
However windows does not to have SIGHUP , SIGUSR1 or SIGUSR2.
So I'm not sure, which signal I could use with windows.


Apart from that there's one minor problem with signals
which might speak against using signal
All blocking io calls might be interrupted, which is not desirable in my
case.

Do you have any suggestions for
Linux / WIndows or both?


#### example code with signals #################
#### a blocking io call here reading a named pipe
#### would be interrupted
import signal
a = 0
def handler(signum,frame):
global a
a += 1

signal.signal(signal.SIGUSR1,handler)
print "hi"
p = open("namedpipe")
while True:
v = p.read(2)
print "V:",a,len(v)
if len(v) != 2: break

print "var a changed, but read() was interrupted :-("


bye


N


== 2 of 2 ==
Date: Sat, Mar 6 2010 4:17 pm
From: News123


News123 wrote:
> Hi,
>
> I'd like to notify python processes asynchronously.
> at notification time a callback should be called
>
> The solution should be working on linux and Windows.
>
> I could add a wrapper to switch between a windows / linux implementation
> though
>
> If possible I'd like to avoid
> - having to poll for an external event
> - having to add a thread.
Well having a blocking thread would be fine though. what I'd really want
to avoid is any polling.
> - changing my existing code
>
> I thought about using signal and os.kill()
> However windows does not to have SIGHUP , SIGUSR1 or SIGUSR2.
> So I'm not sure, which signal I could use with windows.
>
>
> Apart from that there's one minor problem with signals
> which might speak against using signal
> All blocking io calls might be interrupted, which is not desirable in my
> case.
>
> Do you have any suggestions for
> Linux / WIndows or both?
>
>
> #### example code with signals #################
> #### a blocking io call here reading a named pipe
> #### would be interrupted
> import signal
> a = 0
> def handler(signum,frame):
> global a
> a += 1
>
> signal.signal(signal.SIGUSR1,handler)
> print "hi"
> p = open("namedpipe")
> while True:
> v = p.read(2)
> print "V:",a,len(v)
> if len(v) != 2: break
>
> print "var a changed, but read() was interrupted :-("
>
>
> bye
>
>
> N

==============================================================================
TOPIC: indentation error
http://groups.google.com/group/comp.lang.python/t/c0fcd040bcecfca0?hl=en
==============================================================================

== 1 of 1 ==
Date: Sat, Mar 6 2010 4:49 pm
From: Tim Roberts


asit <lipun4u@gmail.com> wrote:
>
>According to me, indentation is ok. but the python interpreter gives
>an indentation error
>
>[asit ~/py] $ python search.py
> File "search.py", line 7
> findResults = string.split(commandOutput, "\n")
> ^
>IndentationError: unindent does not match any outer indentation level

The most likely cause is mixing spaces with tabs.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

==============================================================================
TOPIC: _winreg and access registry settings of another user
http://groups.google.com/group/comp.lang.python/t/52d636db0efe185d?hl=en
==============================================================================

== 1 of 1 ==
Date: Sat, Mar 6 2010 4:57 pm
From: Dennis Lee Bieber


On Thu, 04 Mar 2010 22:24:59 +0100, News123 <news123@free.fr> declaimed
the following in gmane.comp.python.general:

>
> There are potentially at least two wo ways of doing this:
>
Three I think... Though I'm not certain if it will run without
putting dialogs before the user...

Create a .reg file with the update/changes specified relative to
"HKEY_CURRENT_USER";

Copy to someplace like
C:\documents and settings\all users\<something>

Create a "regupdate.bat" file that essentially does

regedt32 "C:\documents and settings\all users\<something>"
delete "%APPDATA%\..\start menu\programs\startup\regupdate.bat"

Copy the .bat file to each users' startup directory.

The next time that user logs on, the bat file will run, and with
luck silently update the registry with the contents of the .reg file (or
you put instructions in the bat file with a pause informing the user to
accept the registry update...


It may not be as clean as remotely accessing the registry itself,
but it sure doesn't need much in the way of privileges -- just file
write to the startup directories of each user on the machine, and the
shared data directory...
--
Wulfraed Dennis Lee Bieber KD6MOG
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/


==============================================================================
TOPIC: yappi v0.42 released
http://groups.google.com/group/comp.lang.python/t/aff789edafee65f5?hl=en
==============================================================================

== 1 of 1 ==
Date: Sat, Mar 6 2010 7:51 pm
From: k3xji


Hi all,

yappi(yet another python profiler with multithreading support)
released.

See:
http://code.google.com/p/yappi/

Thanks,

==============================================================================
TOPIC: Asynchronous HTTP client
http://groups.google.com/group/comp.lang.python/t/8d12ca848ffb171e?hl=en
==============================================================================

== 1 of 1 ==
Date: Sat, Mar 6 2010 10:53 pm
From: Ping


Hi,

I'm trying to find a way to create an asynchronous HTTP client so I
can get responses from web servers in a way like

async_http_open('http://example.com/', callback_func)
# immediately continues, and callback_func is called with response
as arg when it is ready

It seems twisted can do it, but I hesitate to bring in such a big
package as a dependency because my client should be light. Asyncore
and asynchat are lighter but they don't speak HTTP. The asynchttp
project on sourceforge is a fusion between asynchat and httplib, but
it hasn't been updated since 2001 and is seriously out of sync with
httplib.

I'd appreciate it if anyone can shed some lights on this.

Thanks,
Ping


==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en

To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate