syslog best practices -- when to call closelog?

2006-07-10 Thread J Rice
I have a question: When should syslog.closelog() be called? I have a daemon that spends most of its time asleep and quiet, but writes messages to the mail log when active. Should I open the log at the start and keep it open until the program closes? This seems much simpler than issuing three c

Bidirectional communication over unix socket (named pipe)

2006-03-08 Thread J Rice
Hi, I feel like I should apologize in advance because I must be missing something fairly basic and fundamental here. I don't have a book on Python network programming (yet) and I haven't been able to find an answer on the net so far. I am trying to create a pair of programs, one (the client) will

Re: Bidirectional communication over unix socket (named pipe)

2006-03-08 Thread J Rice
OK, never fails that I find a solution once I post a problem. If I use a stream rather than a datagram, it seems to work fine. So... for my education, how would I make this work with a datagram, if I insisted on doing it that way? -- http://mail.python.org/mailman/listinfo/python-list

Re: Bidirectional communication over unix socket (named pipe)

2006-03-08 Thread J Rice
Hi Donn, Not sure I fully understand your suggestion. bind() only works once -- I can't bind again in the client. Same thing with connect() -- once I issue a connect in the server, it rejects it in the client. Doing this as a stream works for what I want, but I would like to understand why it d

Re: Bidirectional communication over unix socket (named pipe)

2006-03-10 Thread J Rice
Thank you, that answers my question! And it works fine with stream, so I can do what I want as well. -- http://mail.python.org/mailman/listinfo/python-list

Threads modify "global" variable -- asking for trouble?

2006-03-16 Thread J Rice
I have been experimenting with some thread programming, but as I'm doing this on my own I am worried I might be making a major mistake. Here's a brief rundown of what I am working on. Multiple threads, via Queue, are used to perform RBL checks on an IP. The threads are passed a defined class (Co

Re: Threads modify "global" variable -- asking for trouble?

2006-03-16 Thread J Rice
My apologizes, I missed the newish FAQ entry on this. The addrbl() method looks like this: def addRBL(self, testname, result, info=""): self.testresultsRBL[testname] = result, info So according to the FAQ, D[x] = y, where D is a dictionary, is atomic and therefore thread-safe. Right?

Re: Threads modify "global" variable -- asking for trouble?

2006-03-18 Thread J Rice
Thank you. Implementing a results queue was much simpler than I expected, and I think as I add this into the rest of the program it will avoid a lot of potential problems later too. -- http://mail.python.org/mailman/listinfo/python-list

Function params with **? what do these mean?

2006-03-20 Thread J Rice
I'm sorry for such a basic question, but I haven't been able to phrase a search that gets me an answer and my books are totally silent on this. I have seen a number of python function defs that take parameters of the form (**param1). Looks like a pointer... but my books on python (basic as they a

Re: Function params with **? what do these mean?

2006-03-20 Thread J Rice
Wow, this is incredibly useful! I can understand why an introductory book wouldn't make use of them, but I am really glad to know about them. I can think of a bunch of ways to simply some code I have using this. -- http://mail.python.org/mailman/listinfo/python-list

Re: trying to grasp OO : newbie Q?

2006-04-13 Thread J Rice
Someone should correct me if I'm wrong but: If you add "print myVar" to __init__, you will see that myVar is assigned to "2" in that function. It doesn't change the assignment of "1" in the class because myVar in __init__ is local to __init__. If you want to change myVar for the whole class, yo