[Tutor] Refreshing the interpreter environment

2005-06-20 Thread lawrence wang
ting again doesn't seem to do it. Thanks in advance for your help. Lawrence Wang ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Importing from directories below yourself...

2005-06-21 Thread lawrence wang
Say I have a directory tree like this: foo - bar -- quux.py - baz -- glonk.py >From within glonk.py, how do I import quux.py? I've tried going to foo, running baz/glonk.py, and using "from bar import quux", but this doesn't seem to work. Thanks in advance! Lawrence

[Tutor] Closing BaseHTTPServer...

2005-07-15 Thread lawrence wang
I've been using BaseHTTPServer (and subclassing BaseHTTPRequestHandler, of course) for a project at work. However, I can't seem to close my connections completely once I'm done with the server. I've tried: server.server_close() del server but when I try to use the same port again, it complains th

Re: [Tutor] Closing BaseHTTPServer...

2005-07-16 Thread lawrence wang
Here's some more detail about how I've got things set up. I left a bunch of things out of my original email; sorry about that, I was rushed for time. I don't have access to the verbatim code right now, but here's the gist. I've subclassed threading.Thread like this: class ServerThread(threading.Th

[Tutor] weird socket errors on linux with asyncore

2007-08-12 Thread Lawrence Wang
apologies if this doesn't belong on tutor. i have a long-running script that manages a bunch of sockets with asyncore, opening 600 connections every 30 seconds for short transactions, and every now and then (like anywhere from twice an hour to once every few hours) i get this weird error: "filedes

[Tutor] Closing SimpleXMLRPCServer properly

2005-08-31 Thread lawrence wang
I have a SimpleXMLRPCServer, which I've tweaked thusly: class StoppableXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer):     def serve_forever(self):         """to stop this server: register a function in the class         that uses it which sets server.stop to True."""         self.stop = Fal

[Tutor] Getting info about processes via pid

2005-10-13 Thread lawrence wang
I'm wondering, though, if there's a way to do this that's less dependent on external programs. I thought os.waitpid() might work, but on *nix I can only call it for child processes. Lawrence Wang ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] XML: Expletive Deleted

2006-06-09 Thread lawrence wang
> >> for item in itemIDs: > >> print item > > yeilds > > > > > > > > Okay, no problem. Now all I have to do is figure out which > particlular.string.of.words.interconnected.by.periods to > pass to extract the values. > > >> for item in itemIDs: > >> print item.nodeValue > > Se

[Tutor] struct.calcsize curiosity...

2008-03-25 Thread Lawrence Wang
>>> struct.calcsize('hq') 12 >>> struct.calcsize('qh') 10 why is this? is it platform-dependent? i'm on mac os x. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor