Re: Metaclasses, decorators, and synchronization

2005-09-25 Thread Jp Calderone
On Sun, 25 Sep 2005 23:30:21 -0400, Victor Ng <[EMAIL PROTECTED]> wrote: >You could do it with a metaclass, but I think that's probably overkill. > >It's not really efficient as it's doing test/set of an RLock all the >time, but hey - you didn't ask for efficient. :) There's a race condition in t

Re: Feature Proposal: Sequence .join method

2005-09-30 Thread Jp Calderone
On Fri, 30 Sep 2005 09:38:25 -0700, Michael Spencer <[EMAIL PROTECTED]> wrote: >Terry Reedy wrote: >> "David Murmann" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> def join(sep, seq): return reduce(lambda x, y: x + sep + y, seq, type(sep)()) >>> >>>damn, i wanted too

Re: Dynamical loading of modules

2005-10-03 Thread Jp Calderone
On Mon, 03 Oct 2005 21:52:21 +0200, Jacob Kroon <[EMAIL PROTECTED]> wrote: >Hi, I'm having some problems with implementing dynamical module loading. >First let me >describe the scenario with an example: > >modules/ >fruit/ >__init__.py >apple.py >banana.py > >apple.py

Re: how to debug when "Segmentation fault"

2005-10-04 Thread Jp Calderone
On Tue, 4 Oct 2005 11:22:24 -0500, Michael Ekstrand <[EMAIL PROTECTED]> wrote: >On Tuesday 04 October 2005 11:13, Maksim Kasimov wrote: >> my programm sometime gives "Segmentation fault" message (no matter >> how long the programm had run (1 day or 2 weeks). And there is >> nothing in log-files tha

Re: updating local()

2005-10-05 Thread Jp Calderone
On Wed, 5 Oct 2005 18:47:06 +0200, Sybren Stuvel <[EMAIL PROTECTED]> wrote: >Flavio enlightened us with: >> Can anyone tell me why, if the following code works, I should not do >> this? >> >> def fun(a=1,b=2,**args): >> >> print 'locals:',locals() >> locals().update(args) >> print

Re: Lambda evaluation

2005-10-06 Thread Jp Calderone
On Thu, 06 Oct 2005 16:18:15 -0400, Joshua Ginsberg <[EMAIL PROTECTED]> wrote: >So this part makes total sense to me: > d = {} for x in [1,2,3]: >... d[x] = lambda y: y*x >... d[1](3) >9 > >Because x in the lambda definition isn't evaluated until the lambda is >executed, at which

Re: Python reliability

2005-10-09 Thread Jp Calderone
On Sun, 9 Oct 2005 23:00:04 +0300 (EEST), Ville Voipio <[EMAIL PROTECTED]> wrote: >I would need to make some high-reliability software >running on Linux in an embedded system. Performance >(or lack of it) is not an issue, reliability is. > >The piece of software is rather simple, probably a >few h

Re: Python reliability

2005-10-09 Thread Jp Calderone
On Mon, 10 Oct 2005 12:18:42 +1000, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >George Sakkis wrote: > >> Steven D'Aprano wrote: >> >> >>>On Sun, 09 Oct 2005 23:00:04 +0300, Ville Voipio wrote: >>> >>> I would need to make some high-reliability software running on Linux in an embedded syste

Re: Help with cPickle for deserializing datetime.datetime instances

2005-10-14 Thread Jp Calderone
On Fri, 14 Oct 2005 01:25:27 -0500, Mingus Tsai <[EMAIL PROTECTED]> wrote: >Hello- please help with unpickling problem: > >I am using Python version 2.3.4 with IDLE version 1.0.3 on a Windows >XPhome system. > >My problem is with using cPickle to deserialize my pickled arrays of >datetime.datetime

Re: write a loopin one line; process file paths

2005-10-18 Thread Jp Calderone
On 18 Oct 2005 14:56:32 -0700, Xah Lee <[EMAIL PROTECTED]> wrote: >is there a way to condense the following loop into one line? There is. exec('696d706f72742072652c206f732e706174680a0a696d6750617468733d5b75272f55736572732f742f7765622f506572696f6469635f646f736167655f6469722f6c616e63692f74342f6f682

Re: python gc performance in large apps

2005-10-22 Thread Jp Calderone
On Fri, 21 Oct 2005 16:13:09 -0400, Robby Dermody <[EMAIL PROTECTED]> wrote: > >Hey guys (thus begins a book of a post :), > >I'm in the process of writing a commercial VoIP call monitoring and >recording application suite in python and pyrex. Basically, this >software sits in a VoIP callcenter-typ

Re: KeyboardInterrupt vs extension written in C

2005-10-22 Thread Jp Calderone
On 22 Oct 2005 22:02:46 +0200, Dieter Maurer <[EMAIL PROTECTED]> wrote: >"Tamas Nepusz" <[EMAIL PROTECTED]> writes on 20 Oct 2005 15:39:54 -0700: >> The library I'm working on >> is designed for performing calculations on large-scale graphs (~1 >> nodes and edges). I want to create a Python int

Re: High Order Messages in Python

2005-10-22 Thread Jp Calderone
On 22 Oct 2005 14:12:16 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >I'm reading about "high order messages" in Ruby by Nat Pryce, and >thinking if it could be util and if so, if it could be done in Python. >Someone already tried? Here's an example of the idea, in Python: def messa

Re: High Order Messages in Python

2005-10-22 Thread Jp Calderone
On 22 Oct 2005 15:11:39 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >Hum... I thnk you dont get the ideia: I'm not talking abou High Order >Functions. >What ho call "High Order Methods is some like "connecting" some >'generic' methods created to do things like this: >claimants.where.r

Re: Extention String returning

2005-10-24 Thread Jp Calderone
On 24 Oct 2005 11:28:23 -0700, Tuvas <[EMAIL PROTECTED]> wrote: >I have been writing a program that is designed to return an 8 byte >string from C to Python. Occasionally one or more of these bytes will >be null, but the size of it will always be known. How can I write an >extention module that wil

Re: what is lambda used for in real code?

2004-12-31 Thread Jp Calderone
On Fri, 31 Dec 2004 22:09:49 -0500, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Adam DePrince" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > In sort, we must preserve the ability to create an anonymous function > > simply because we can do so for every other object type, and fu

Re: PEP 288 ponderings

2005-01-01 Thread Jp Calderone
On Sun, 02 Jan 2005 01:04:06 GMT, Steven Bethard <[EMAIL PROTECTED]> wrote: >PEP 288 was mentioned in one of the lambda threads and so I ended up > reading it for the first time recently. I definitely don't like the > idea of a magical __self__ variable that isn't declared anywhere. It > also

Re: Continuations Based Web Framework - Seaside.

2005-01-02 Thread Jp Calderone
On Sun, 2 Jan 2005 13:34:02 -0500, Kendall Clark <[EMAIL PROTECTED]> wrote: >On Sun, Jan 02, 2005 at 10:03:10AM -0500, Steve Holden wrote: > > > I did actually do some sort-of-related work in this area, which I > > presented at PyCon DC 2004 - you can access the paper at > > > >http://www.py

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Dec 30)

2005-01-04 Thread Jp Calderone
On Tue, 04 Jan 2005 16:41:05 +0100, Thomas Heller <[EMAIL PROTECTED]> wrote: >Skip Montanaro <[EMAIL PROTECTED]> writes: > > > michele> BTW what's the difference between .encode and .decode ? > > > > I started to answer, then got confused when I read the docstrings for > > unicode.encode and u

Re: Hlelp clean up clumpsy code

2005-01-04 Thread Jp Calderone
On Tue, 04 Jan 2005 08:18:58 -0800, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Nick Coghlan wrote: > > A custom generator will do nicely: > > > > Py> def flatten(seq): > > ... for x in seq: > > ... if hasattr(x, "__iter__"): > > ... for y in flatten(x): > > ... yield y

Re: get the IP address of a host

2005-01-06 Thread Jp Calderone
On Thu, 06 Jan 2005 14:35:16 +0100, J Berends <[EMAIL PROTECTED]> wrote: > > From several approached I came up with the following code: > > def getipaddr(hostname='default'): > """Given a hostname, perform a standard (forward) lookup and return > a list of IP addresses for that host."""

Re: sorting on keys in a list of dicts

2005-01-06 Thread Jp Calderone
On Thu, 06 Jan 2005 15:31:22 +0100, J Berends <[EMAIL PROTECTED]> wrote: >Suppose I have a list of dictionaries and each dict has a common keyname > with a (sortable) value in it. > > How can I shuffle their position in the list in such way that they > become sorted. > In Python 2.4, im

Re: Embedding a restricted python interpreter

2005-01-06 Thread Jp Calderone
On Thu, 06 Jan 2005 16:05:50 +0100, Peter Maas <[EMAIL PROTECTED]> wrote: >Craig Ringer schrieb: > > That is my understanding. In fact, I'd say with Python it's nearly > > impossible given how dynamic everything is and the number of tricks that > > can be used to obfuscate what you're doing. Think

Re: Embedding a restricted python interpreter

2005-01-06 Thread Jp Calderone
On 06 Jan 2005 07:32:25 -0800, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: >Jp Calderone <[EMAIL PROTECTED]> writes: > > A Python sandbox would be useful, but the hosting provider's excuse > > for not allowing you to use mod_python is complete

Re: Asyncore

2005-01-07 Thread Jp Calderone
On 7 Jan 2005 00:14:26 -0800, [EMAIL PROTECTED] wrote: >Is there any tutorial and docs with samples how to use asyncore module? See these threads: http://mail.python.org/pipermail/python-list/2004-March/214105.html http://mail.python.org/pipermail/python-dev/2004-November/049819.html

Re: "A Fundamental Turn Toward Concurrency in Software"

2005-01-08 Thread Jp Calderone
On Sat, 08 Jan 2005 14:22:30 GMT, Lee Harr <[EMAIL PROTECTED]> wrote: >>> [http://www.gotw.ca/publications/concurrency-ddj.htm]. It argues that the > >> continous CPU performance gain we've seen is finally over. And that future > >> gain would primary be in the area of software concurrency taking

Re: smtplib and TLS

2005-06-21 Thread Jp Calderone
On 21 Jun 2005 08:39:02 -0700, Matthias Kluwe <[EMAIL PROTECTED]> wrote: >> From: "Paul Rubin" "http://phr.cx"@NOSPAM.invalid > >>> "Matthias Kluwe" <[EMAIL PROTECTED]> writes: >>> After getting a @gmail.com address, I recognized I had to use TLS in my >>> python scripts using smtplib in order to g

Re: Hardening enviroment by overloading __import__?

2005-06-23 Thread Jp Calderone
On Thu, 23 Jun 2005 13:12:12 -0700, Steve Juranich <[EMAIL PROTECTED]> wrote: >If this is a FAQ, please let me know where the answer is. > >I have in some code an 'eval', which I hate, but it's the shortest >path to where I need to get at this point. I thought that one way I >could harden the envi

Re: webserver application (via Twisted?)

2005-06-24 Thread Jp Calderone
On Fri, 24 Jun 2005 12:35:40 GMT, flupke <[EMAIL PROTECTED]> wrote: >I need to program and setup serveral webservices. >If i were still using jsp, i would use Tomcat to make the several >applications available on a given port. >How can i accomplish this in Python? >I was thinking about Twisted but

Re: Newbie question: how to keep a socket listening?

2005-06-24 Thread Jp Calderone
On Fri, 24 Jun 2005 21:21:34 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >ncf wrote: >> Heh, like I said. I was not at all sure. :P >> >> Nevertheless, could this be the problem? =\ > >You *may* correct, mainly because the OP's code doesn't appear to spawn >off new threads to handle the client c

Re: Newbie question: SOLVED (how to keep a socket listening), but still some questions

2005-06-24 Thread Jp Calderone
On Sat, 25 Jun 2005 01:36:56 -, Grant Edwards <[EMAIL PROTECTED]> wrote: >On 2005-06-25, Giovanni Tumiati <[EMAIL PROTECTED]> wrote: > >> (2)Does one have to do a socket.shutdown() before one does a >> socket.close?? > >No. > >[I've never figured out why one would do a shutdown RDWR >rather tha

Re: Background thread

2005-06-25 Thread Jp Calderone
On Sat, 25 Jun 2005 11:36:57 +0100, Jorge Louis De Castro <[EMAIL PROTECTED]> wrote: >Hi, > >I'm new to python and I'm having trouble figuring out a way to have a thread >running on the background that over rules the raw_input function. The example >I'm working on is something like having a thre

Re: a dictionary from a list

2005-06-25 Thread Jp Calderone
On Sat, 25 Jun 2005 09:10:33 -0400, Roy Smith <[EMAIL PROTECTED]> wrote: >Terry Hancock <[EMAIL PROTECTED]> wrote: >> Before the dict constructor, you needed to do this: >> >> d={} >> for key in alist: >> d[key]=None > >I just re-read the documentation on the dict() constructor. Why does it >s

Re: [Twisted-Python] Limiting number of concurrent client connections

2005-06-28 Thread Jp Calderone
On Tue, 28 Jun 2005 10:47:04 +0100, Toby Dickenson <[EMAIL PROTECTED]> wrote: >Im finding that Win32Reactor raises an exception on every iteration of the >main loop if I exceed the limit of 64 WaitForMultipleObjects. > >I would prefer to avoid this fairly obvious denial-of-service problem by >limit

Re: importing packages from a zip file

2005-06-29 Thread Jp Calderone
On Wed, 29 Jun 2005 18:49:10 +, Peter Tillotson <[EMAIL PROTECTED]> wrote: >cheers Scott > >should have been >from myZip.zip import base.branch1.myModule.py > >and no it didn't work, anyone know a reason why this syntax is not >preferred ?? > >sorry posted the soln again, it works but feels nas

Re: python broadcast socket

2005-06-29 Thread Jp Calderone
On Thu, 30 Jun 2005 00:13:45 +0200, Irmen de Jong <[EMAIL PROTECTED]> wrote: >Grant Edwards wrote: > >> Under Linux, you need to be root to send a broadcase packet. > >I don't think this is true. > I think you're right. I believe you just need to set the broadcast SOL_SOCKET option. >>> import

Re: Scket connection to server

2005-06-30 Thread Jp Calderone
On Thu, 30 Jun 2005 18:39:27 +0100, Steve Horsley <[EMAIL PROTECTED]> wrote: >JudgeDread wrote: >> hello python gurus >> >> I would like to establish a socket connection to a server running a service >> on port 2. the host address is 10.214.109.50. how do i do this using >> python? >> >> many t

Re: Favorite non-python language trick?

2005-07-01 Thread Jp Calderone
On Fri, 01 Jul 2005 15:02:10 -0500, Rocco Moretti <[EMAIL PROTECTED]> wrote: >Joseph Garvin wrote: > >> I'm curious -- what is everyone's favorite trick from a non-python >> language? And -- why isn't it in Python? > >I'm not aware of a language that allows it, but recently I've found >myself wanti

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Jp Calderone
On Fri, 01 Jul 2005 20:36:29 GMT, Ron Adam <[EMAIL PROTECTED]> wrote: >Tom Anderson wrote: > >> So, if you're a pythonista who loves map and lambda, and disagrees with >> Guido, what's your background? Functional or not? > >I find map too limiting, so won't miss it. I'm +0 on removing lambda >only

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-02 Thread Jp Calderone
On Sun, 03 Jul 2005 01:01:18 -0400, Christopher Subich <[EMAIL PROTECTED]> wrote: >Steven D'Aprano wrote: >> comps. But reduce can't be written as a list comp, only as a relatively >> complex for loop at a HUGE loss of readability -- and I've never used >> Lisp or Scheme in my life. I'm surely not

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Jp Calderone
On Sun, 03 Jul 2005 14:43:14 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >Steven D'Aprano wrote: >> Frankly, I find this entire discussion very surreal. Reduce etc *work*, >> right now. They have worked for years. If people don't like them, nobody >> is forcing them to use them. Python is being

Re: Using regular expressions in internet searches

2005-07-03 Thread Jp Calderone
On 3 Jul 2005 10:49:03 -0700, [EMAIL PROTECTED] wrote: >What is the best way to use regular expressions to extract information >from the internet if one wants to search multiple pages? Let's say I >want to search all of www.cnn.com and get a list of all the words that >follow "Michael." > >(1) Is P

Re: Favorite non-python language trick?

2005-07-03 Thread Jp Calderone
On Sun, 03 Jul 2005 15:40:38 -0500, Rocco Moretti <[EMAIL PROTECTED]> wrote: >Jp Calderone wrote: >> On Fri, 01 Jul 2005 15:02:10 -0500, Rocco Moretti >> <[EMAIL PROTECTED]> wrote: >> >>> >>> I'm not aware of a language that allows it, b

Re: looping over a big file

2005-07-03 Thread Jp Calderone
On Sun, 3 Jul 2005 23:52:12 +0200, martian <[EMAIL PROTECTED]> wrote: >Hi, > >I've a couple of questions regarding the processing of a big text file >(16MB). > >1) how does python handle: > >> for line in big_file: > >is big_file all read into memory or one line is read at a time or a buffer >is us

Re: Use cases for del

2005-07-06 Thread Jp Calderone
On Wed, 06 Jul 2005 09:45:56 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >Tom Anderson wrote: >> How about just getting rid of del? Removal from collections could be >> done with a method call, and i'm not convinced that deleting variables >> is something we really need to be able to do (most ot

Re: DNS access

2005-07-13 Thread Jp Calderone
On 13 Jul 2005 07:44:41 -0700, laksh <[EMAIL PROTECTED]> wrote: >im looking for some advice regarding DNS lookup using python > >is it possible to give parameters like the IP of a DNS server and the >DNS query to a python program and obtain the response from the DNS >server ? > Not using the built

Re: DNS access

2005-07-13 Thread Jp Calderone
On Wed, 13 Jul 2005 15:22:35 -0400, Chris Lambacher <[EMAIL PROTECTED]> wrote: >reverse dns lookup is not really special compared to a regular dns lookup. >you just need to look up a special name: >http://www.dnsstuff.com/info/revdns.htm > >to format the ip address properly use something like: >def

Re: threads and sleep?

2005-07-14 Thread Jp Calderone
On 14 Jul 2005 05:10:38 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: >Andreas Kostyrka <[EMAIL PROTECTED]> writes: >> Basically the current state of art in "threading" programming doesn't >> include a safe model. General threading programming is unsafe at the >> moment, and there's no

Re: how to get rate of pop3 receiving progress?

2005-07-14 Thread Jp Calderone
On Thu, 14 Jul 2005 17:09:10 +0800, Leo Jay <[EMAIL PROTECTED]> wrote: when i use POP3.retr() in poplib module, the retr() function will not return until the receiving progress is finished so, is there any way to get the rate of receiving progress? An extremely rudamentary example of how you

Re: Filtering out non-readable characters

2005-07-16 Thread Jp Calderone
On Sat, 16 Jul 2005 19:01:50 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >George Sakkis wrote: >> "Bengt Richter" <[EMAIL PROTECTED]> wrote: >>> >>> identity = ''.join([chr(i) for i in xrange(256)]) >> >> Or equivalently: >identity = string.maketrans('','') > >Wow! That's handy, not to ment

Re: Need to interrupt to check for mouse movement

2005-07-20 Thread Jp Calderone
On Thu, 21 Jul 2005 00:18:58 -0400, Christopher Subich <[EMAIL PROTECTED]> wrote: >Peter Hansen wrote: >> stringy wrote: >> >>> I have a program that shows a 3d representation of a cell, depending on >>> some data that it receives from some C++. It runs with wx.timer(500), >>> and on wx.EVT_TIMER,

Re: Need to interrupt to check for mouse movement

2005-07-21 Thread Jp Calderone
On Thu, 21 Jul 2005 00:51:45 -0400, Christopher Subich <[EMAIL PROTECTED]> wrote: >Jp Calderone wrote: > >> In the particular case of wxWidgets, it turns out that the *GUI* blocks >> for long periods of time, preventing the *network* from getting >> attention. But

Re: Need to interrupt to check for mouse movement

2005-07-21 Thread Jp Calderone
On 20 Jul 2005 22:06:31 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: >Christopher Subich <[EMAIL PROTECTED]> writes: >> > In the particular case of wxWidgets, it turns out that the *GUI* >> > blocks for long periods of time, preventing the *network* from >> > getting attention. But I

Re: Need to interrupt to check for mouse movement

2005-07-21 Thread Jp Calderone
On Thu, 21 Jul 2005 05:42:32 -, Donn Cave <[EMAIL PROTECTED]> wrote: >Quoth Paul Rubin : >| Christopher Subich <[EMAIL PROTECTED]> writes: >| > > In the particular case of wxWidgets, it turns out that the *GUI* >| > > blocks for long periods of time, preventing the *ne

Re: Need to interrupt to check for mouse movement

2005-07-21 Thread Jp Calderone
On Thu, 21 Jul 2005 02:33:05 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >Jp Calderone wrote: >> In the particular case of wxWidgets, it turns out that the *GUI* blocks >> for long periods of time, preventing the *network* from getting >> attention. But I agree w

Re: Buffering problem using subprocess module

2005-07-21 Thread Jp Calderone
On 21 Jul 2005 06:14:25 -0700, "Dr. Who" <[EMAIL PROTECTED]> wrote: >I am using the subprocess module in 2.4. Here's the fragment: > >bufcaller.py: > import sys, subprocess > proc = subprocess.Popen('python bufcallee.py', bufsize=0, shell=True, >stdout=subprocess.PIPE) > for line

Re: Stupid question: Making scripts python-scripts

2005-07-21 Thread Jp Calderone
On Thu, 21 Jul 2005 16:34:30 +0200, Jan Danielsson <[EMAIL PROTECTED]> wrote: >Hello all, > > How do I make a python script actually a _python_ in unix:ish >environments? > > [snip] Put "#!/usr/bin/python". Install the program using distutils: if necessary, distutils will rewrite the #! line t

Re: Overriding a built-in exception handler

2005-07-21 Thread Jp Calderone
On 21 Jul 2005 07:39:10 -0700, [EMAIL PROTECTED] wrote: >I'm having a tough time figuring this one out: > > >class MyKBInterrupt( . ): > print "Are you sure you want to do that?" > >if __name__ == "__main__": > while 1: > print "Still here..." > > >So this thing keeps printing

Re: Simple Problem

2005-07-24 Thread Jp Calderone
On 24 Jul 2005 18:14:13 -0700, ncf <[EMAIL PROTECTED]> wrote: >I know I've seen this somewhere before, but does anyone know what the >function to escape a string is? (i.e., encoding newline to "\n" and a >chr(254) to "\xfe") (and visa-versa) > >Thanks for helping my ignorance :P Python 2.4.1 (

RE: Terminate a thread that doesn't check for events

2005-08-02 Thread Jp Calderone
On Tue, 2 Aug 2005 09:51:31 -0400, Liu Shuai <[EMAIL PROTECTED]> wrote: >Can someone please comment on this? > > [snip - how to stop a thread without its cooperation?] There's no way to do this with threads, sorry. Perhaps you could use a child process, instead. Those are typically easy to term

Re: Creating a graphical interface on top of SSH. How?

2005-08-16 Thread Jp Calderone
On 16 Aug 2005 07:10:25 -0700, "John F." <[EMAIL PROTECTED]> wrote: >I want to write a client app in Python using wxWindows that connects to >my FreeBSD server via SSH (using my machine account credentials) and >runs a python or shell script when requested (by clicking a button for >instance). > >C

Re: Basic Server/Client socket pair not working

2005-08-29 Thread Jp Calderone
On Mon, 29 Aug 2005 21:30:51 +0200, Michael Goettsche <[EMAIL PROTECTED]> wrote: >Hi there, > >I'm trying to write a simple server/client example. The client should be able >to send text to the server and the server should distribute the text to all >connected clients. However, it seems that only t

Re: python and ajax

2005-08-29 Thread Jp Calderone
On Mon, 29 Aug 2005 12:04:46 -0700 (PDT), Steve Young <[EMAIL PROTECTED]> wrote: >Hi, I was wondering if anybody knew of any good >tutorial/example of AJAX/xmlhttprequest in python. >Thanks. > There's a short example of Nevow's LivePage online here: http://divmod.org/svn/Nevow/trunk/examples/live

Re: Using select on a unix command in lieu of signal

2005-08-29 Thread Jp Calderone
On 29 Aug 2005 17:57:34 -0700, rh0dium <[EMAIL PROTECTED]> wrote: >So here's how I solved this.. It's seems crude - but hey it works. >select not needed.. > >def runCmd( self, cmd, timeout=None ): >self.logger.debug("Initializing function %s - %s" % >(sys._getframe().f_code.co_name,cmd

Re: Sockets: code works locally but fails over LAN

2005-08-31 Thread Jp Calderone
On 31 Aug 2005 06:03:00 -0700, n00m <[EMAIL PROTECTED]> wrote: >import socket, thread >host, port = '192.168.0.3', 1434 >s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >s2.connect((host, 1433)) >s1.bind((host, port)) >s1.listen(1) >cn,

Re: threading.Thread vs. signal.signal

2005-09-17 Thread Jp Calderone
On Sat, 17 Sep 2005 19:24:54 -0400, Jack Orenstein <[EMAIL PROTECTED]> wrote: >I'd like to create a program that invokes a function once a second, >and terminates when the user types ctrl-c. So I created a signal >handler, created a threading.Thread which does the invocation every >second, and star

Re: Can someone explain what I've done wrong...

2005-09-17 Thread Jp Calderone
On Sun, 18 Sep 2005 02:10:50 +0100, Jason <[EMAIL PROTECTED]> wrote: >Hi, > >I'm following a tutorial about classes, and have created the following >(well, copied it from the manual buy added my own and wifes names)... > >class Person: > population=0 > > def __init__(self,name): > s

Re: Crypto.Cipher.ARC4, bust or me doing something wrong?

2005-09-20 Thread Jp Calderone
On Tue, 20 Sep 2005 16:08:19 +0100, Michael Sparks <[EMAIL PROTECTED]> wrote: >Hi, > > >I suspect this is a bug with AMK's Crypto package from >http://www.amk.ca/python/code/crypto , but want to >check to see if I'm being dumb before posting a bug >report. > >I'm looking at using this library and t

Re: Threading, real or simulated?

2005-09-21 Thread Jp Calderone
On Wed, 21 Sep 2005 18:23:33 -0500, Sam <[EMAIL PROTECTED]> wrote: >I'm using Python 2.3.5 with pygtk 2.4.1, and I'm using the second threading >approach from pygtk's FAQ 20.6 - invoking "gtk.gdk.threads_init()", and >wrapping all gtk/gdk function calls with >gtk.threads_enter()/gtk.threads_leav

Re: [PATCH] Re: frozenset() without arguments should return a singleton

2005-02-12 Thread Jp Calderone
On Sat, 12 Feb 2005 23:21:58 +0100, Stefan Behnel <[EMAIL PROTECTED]> wrote: > > > Raymond Hettinger wrote: > >Stefan Behnel wrote: > >>I stumbled over the fact that 'frozenset()' doesn't return a constant but > >>creates a new object everytime. Since it is immutable, I wrote to c.l.py > >>that

Re: Replacing words from strings except 'and' / 'or' / 'and not'

2004-11-28 Thread Jp Calderone
On 28 Nov 2004 15:33:13 -0800, [EMAIL PROTECTED] (John Machin) wrote: >Skip Montanaro <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > > >> > Is there a reason to use sets here? I think lists will do as well. > > >> > > >> Sets are implemented using dictionaries, so the "

Re: Closing files

2004-11-28 Thread Jp Calderone
On Sun, 28 Nov 2004 18:59:31 -0600, [EMAIL PROTECTED] (Henrik Holm) wrote: >I have recently started playing around with Python. Some of the things > I have done have involved reading files. The way I do this is along the > lines of > > [snip] http://www.google.com/search?q=site%3Amail.python.

Re: asynchat and threading

2004-11-29 Thread Jp Calderone
On Mon, 29 Nov 2004 16:05:14 -0500, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > If I could simply do: py-get twisted > and have all of the dependencies resolved, it would be wonderful. as a > prototype, I would suggest wrapping apt-get with a python envelope which > automatically invokes

Re: Class methods in Python/C?

2004-11-30 Thread Jp Calderone
On Tue, 30 Nov 2004 22:39:15 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: >Craig Ringer wrote: > > Hi folks > > > > I've been doing some looking around, but have been unable to find out > > how to implement class methods on Python objects written in C. "Why are > > you using C?" you ask? > > >

Re: SOAPpy/ZSI/Twisted SOAP over stdin/stdout?

2004-11-30 Thread Jp Calderone
On Tue, 30 Nov 2004 14:25:50 GMT, Harry George <[EMAIL PROTECTED]> wrote: >Normally the SOAP Servers are designed to take control of a port and > run their own sockets via inheritance from SocktServer. > > But under inetd and xinetd, the port is controlled elsewhere and the > service just gets the

Re: module imports and memory usage

2004-11-30 Thread Jp Calderone
On Tue, 30 Nov 2004 10:02:27 -0500, Brad Tilley <[EMAIL PROTECTED]> wrote: >When memory usage is a concern, is it better to do: > > from X import Y > > or > > import X There is no difference. If you are concerned about memory usage, you probably need to take a look at the data structures ho

Re: pre-PEP generic objects

2004-11-30 Thread Jp Calderone
On Tue, 30 Nov 2004 17:52:33 -0500, =?iso-8859-1?Q?Fran=E7ois?= Pinard <[EMAIL PROTECTED]> wrote: >[Scott David Daniels] > > > You can simplify this: > > class Hash(object): > > def __init__(self, **kwargs): > > for key,value in kwargs.items(): > > setattr(self, key, value

Re: IMAP UTF-7, any codec for that anywhere?

2004-12-01 Thread Jp Calderone
On Wed, 01 Dec 2004 10:35:59 +0100, Max M <[EMAIL PROTECTED]> wrote: >Brian Quinlan wrote: > > Max M wrote: > > > >> Is there any codec available for handling The special UTF-7 codec for > >> IMAP? > > > Is there something special do you need or is recipe OK? > > > > >>> u"\u00ff".encode('

Re: non blocking read()

2004-12-01 Thread Jp Calderone
On Wed, 01 Dec 2004 19:39:45 +0100, Uwe Mayer <[EMAIL PROTECTED]> wrote: >Hi, > > I use select() to wait for a file object (stdin) to become readable. In that > situation I wanted to read everything available from stdin and return to > the select statement to wait for more. > > However, the file

Re: non blocking read()

2004-12-01 Thread Jp Calderone
On 01 Dec 2004 15:55:18 -0500, David Bolen <[EMAIL PROTECTED]> wrote: >Jp Calderone <[EMAIL PROTECTED]> writes: > > > def nonBlockingReadAll(fileObj): > > bytes = [] > > while True: > > b = fileObj.read(1024) > >

Re: installing wxPython on Linux and Windows

2004-12-02 Thread Jp Calderone
On Thu, 02 Dec 2004 15:29:53 +0100, Peter Maas <[EMAIL PROTECTED]> wrote: >Diez B. Roggisch schrieb: > >>Same task on Win2k: download wxPython-setup.exe, double-click, done. > >>Took me approx. 1 minute. This strikes me. Why are some tasks so hard > >>on Linux and so easy on Windows? After all wxPy

Re: pre-PEP generic objects

2004-12-02 Thread Jp Calderone
On Thu, 02 Dec 2004 12:26:31 -0800, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Nick Craig-Wood wrote: > > Scott David Daniels <[EMAIL PROTECTED]> wrote: > >> You can simplify this: > >> class Hash(object): > >> def __init__(self, **kwargs): > >> for key,value in kwargs.items():

Re: decorators ?

2004-12-02 Thread Jp Calderone
On Thu, 02 Dec 2004 18:30:15 -0800, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > [snip] > > Technically, everything can be performed in assembly. The point of > syntactic sugar (or ammonia) is to make things less painful. While > everything was possible before, adding the decorators /after/ def

Re: finding byte order

2004-12-03 Thread Jp Calderone
On Fri, 03 Dec 2004 19:19:48 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> I would like to have a test to tell me if the current machine is ^^^ > > using big or small endian, this way I could use the array module in > > the

Re: using cmd.exe as a telnet client

2004-12-03 Thread Jp Calderone
On Fri, 03 Dec 2004 16:31:40 -0600, Donnal Walter <[EMAIL PROTECTED]> wrote: >Several months ago I tried using the telnet module (on Windows XP) to > communicate with a proprietary host on our network. This was > unsuccessful due to problems with "option negotiation", and I gave up on > the proj

Re: using cmd.exe as a telnet client

2004-12-04 Thread Jp Calderone
On Sat, 4 Dec 2004 03:31:12 -0800 (PST), Eyal Lotem <[EMAIL PROTECTED]> wrote: > > You simple have to run PyInvoke's server.py on the > server, and then in the client, you can Pythonically > control anything on the server: > > client = pyinvoke.connect(('some_server', some_port)) > client.modules

Re: Quixote+Nevow+LivePage

2004-12-04 Thread Jp Calderone
On 3 Dec 2004 22:02:51 -0800, Mir Nazim <[EMAIL PROTECTED]> wrote: >Hi > > I am a PHP developer and in trying to get a better tool for developing > web apps, I have been strugling with zope for past few months and > still could not get anything useful work up and going. I really felt > that "Z" sh

Re: Quixote+Nevow+LivePage

2004-12-04 Thread Jp Calderone
On Sat, 4 Dec 2004 15:40:44 -0200, Carlos Ribeiro <[EMAIL PROTECTED]> wrote: >On Sat, 04 Dec 2004 16:17:06 GMT, Jp Calderone <[EMAIL PROTECTED]> wrote: > > I haven't used LivePage myself, but someone in the know tells me > > that LivePage requires an extra, no

Re: Quixote+Nevow+LivePage

2004-12-04 Thread Jp Calderone
On Sat, 04 Dec 2004 20:05:59 -0700, Dave Brueck <[EMAIL PROTECTED]> wrote: >Jp Calderone wrote: > > On 3 Dec 2004 22:02:51 -0800, Mir Nazim <[EMAIL PROTECTED]> wrote: > >>Q1) Is it possibe to use "Nevow + LivePage + Quixote" together in a > >>web

Re: import fails

2004-12-05 Thread Jp Calderone
On Sun, 5 Dec 2004 19:52:57 +0100, Laszlo Zsolt Nagy <[EMAIL PROTECTED]> wrote: >Hello all, > > Can anyone explain this: > > > C:\Python\Projects\DbDesigner>python > Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32 > Type "help", "copyright", "credits" or "license"

Re: help using sockets, and OOP?

2004-12-05 Thread Jp Calderone
On Mon, 06 Dec 2004 06:02:40 +1000, Dfenestr8 <[EMAIL PROTECTED]> wrote: >Hi. > > I realise, that there's probably something intrinsic to OOP that I don't > understand here. Or maybe it's something to do with sockets. I'm not sure. > > Basically, I'm trying to hack up an IRC bot, that joins two s

Re: help using sockets, and OOP?

2004-12-05 Thread Jp Calderone
On Mon, 06 Dec 2004 07:45:34 +1000, Dfenestr8 <[EMAIL PROTECTED]> wrote: >On Sun, 05 Dec 2004 20:17:31 +, Jp Calderone wrote: > > > Your problem doesn't seem to have anything to do with "OOP" (whatever > > that is). Rather, you are try

Re: using cmd.exe as a telnet client

2004-12-07 Thread Jp Calderone
On Mon, 06 Dec 2004 12:52:31 -0600, Donnal Walter <[EMAIL PROTECTED]> wrote: >I wrote: > > I've been wanting to get acquainted with Twisted for awhile > > now, ... BTW, do you know if Twisted's option negotiation > > uses a callback function? I might download it to take a look, ... > > Sorry I did

Re: Flow based programming & python coding style

2004-12-15 Thread Jp Calderone
On Wed, 15 Dec 2004 12:30:07 -0200, Carlos Ribeiro <[EMAIL PROTECTED]> wrote: >Hi, > > A friend of mine passed me some links about a great concept (not new > in fact, only new to me): > > -- http://www.jpaulmorrison.com/fbp/ > -- http://c2.com/cgi/wiki?FlowBasedProgramming > > I found many of

Re: Why are tuples immutable?

2004-12-15 Thread Jp Calderone
On Wed, 15 Dec 2004 14:18:21 GMT, Roel Schroeven <[EMAIL PROTECTED]> wrote: >Antoon Pardon wrote: > > Op 2004-12-15, Fredrik Lundh schreef <[EMAIL PROTECTED]>: > >>sorry, but I don't understand your reply at all. are you saying that > >>dictionaries > >>could support mutable keys (e.g lists) by

Re: Why are tuples immutable?

2004-12-17 Thread Jp Calderone
On Fri, 17 Dec 2004 11:21:25 -0800, Jeff Shannon <[EMAIL PROTECTED]> wrote: > > No -- the mathematical definition of 'hashable' fails for mutable types, > and Python doesn't try to pretend that it can hash mutable types. > Python also provides features so that user-defined immutable types can

Re: Why no list heritable type?

2004-12-17 Thread Jp Calderone
On Fri, 17 Dec 2004 13:24:43 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: >Jeff Shannon <[EMAIL PROTECTED]> writes: > > > Sion Arrowsmith wrote: > > Additionally, as I understand it UserList and UserDict are implemented > > entirely in Python, which means that there can be significant > > perfor

Re: Is this a good use for lambda

2004-12-17 Thread Jp Calderone
On Fri, 17 Dec 2004 15:58:09 -0800, Charlie Taylor <[EMAIL PROTECTED]> wrote: > > I find that I use lambda functions mainly for callbacks to things like > integration or root finding routines as follows. > > flow = integrate(lambda x: 2.0*pi * d(x)* v(x) * sin(a(x)),xBeg, xEnd) > > root = find

Re: better lambda support in the future?

2004-12-17 Thread Jp Calderone
On Fri, 17 Dec 2004 18:16:08 -0500, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Jason Zheng" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Steven Bethard wrote: > >> Jason Zheng wrote: > >> > >>> I'm wondering why python still has limited lambda support. What's > >>> stopping

Re: spawn* or exec* and fork, what should I use and how ?

2004-12-15 Thread Jp Calderone
On Thu, 16 Dec 2004 03:00:45 GMT, Lingyun Yang <[EMAIL PROTECTED]> wrote: >Hi, > >I want to use python as a "shell like" program, > and execute an external program in it( such as mv, cp, tar, gnuplot) > I tried: > > os.execv("/bin/bash",("/usr/bin/gnuplot",'-c "gnuplot < plot.tmp"')) > > s

  1   2   >