Re: Managing import statements

2005-12-10 Thread Jean-Paul Calderone
On Sat, 10 Dec 2005 11:54:47 -0700, Shane Hathaway <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: >> On Sat, 10 Dec 2005 02:21:39 -0700, Shane Hathaway <[EMAIL PROTECTED]> wrote: >>>How about PyLint / PyChecker? Can I configure one of them to tell me >>

Re: Question about tuple lengths

2005-12-14 Thread Jean-Paul Calderone
uot;,) >>> type(t2) >>> t3 = "blah", >>> type(t3) >>> It's the comma that makes it a tuple. The parenthesis are only required in cases where the expression might mean something else without them. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading in python

2005-12-14 Thread Jean-Paul Calderone
de that mostly calls >into C libraries that release the GIL. For example, a threaded spider >scales nicely on SMP. Yes. Nearly as well as a single-threaded spider ;) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Wed Development - Dynamically Generated News Index

2005-12-17 Thread Jean-Paul Calderone
tion("News Site") webserver = appserver.NevowSite(NewsIndex(cp)) internet.TCPServer(80, webserver).setServiceParent(application) # Run with twistd -noy For more information about Nevow, checkout the Wiki - <http://divmod.org/trac/wiki/DivmodNevow> - or the mailing list - <http://twist

Re: Wed Development - Dynamically Generated News Index

2005-12-18 Thread Jean-Paul Calderone
On 18 Dec 2005 12:27:55 -0800, [EMAIL PROTECTED] wrote: >Hi Jean-Paul, > >I am a bit lost in you code. Is it possible for you to step through >it? For in depth-assistance, it would probably be best to continue on [EMAIL PROTECTED] You might also want to check out some of the lin

Re: Which Python web framework is most like Ruby on Rails?

2005-12-22 Thread Jean-Paul Calderone
7;t a web framework, though it includes an HTTP server. >Webware : Python licence >Zope : ZPL (Zope Public Licence) > >There doesn't seem to be an obvious choice, but the GPL isn't used much >here > Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IMAP4 Memory Error

2005-12-23 Thread Jean-Paul Calderone
. You might also address it as a deployment issue, and run fewer programs on the host in question, or reboot it more frequently. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: XPath-like filtering for ElementTree

2005-12-26 Thread Jean-Paul Calderone
ple pieces, pass parts of it around as real, live objects with introspectable APIs, allow for mutation of portions of the query, re-arrange it, etc. All this is possible with strings too, just way harder :) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: python coding contest

2005-12-27 Thread Jean-Paul Calderone
seg(x):return urllib2.urlopen('http://7seg.com/'+x).read() >> >And another one from me as well. > >class a: > def __eq__(s,o):return 1 >seven_seg=lambda i:a() > This is shorter as "__eq__=lambda s,o:1". But I can't find the first post in this thread... What are you guys talking about? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple question on Parameters...

2005-12-28 Thread Jean-Paul Calderone
rue, outlineColor=(1, 1, 1), fillColor=(0, 0, 0.25)): ... Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a refrence issue?

2005-12-28 Thread Jean-Paul Calderone
or like this: import copy tmp = copy.copy(myList) This is as opposed to a deep copy, which is like this: import copy tmp = copy.deepcopy(myList) What "tmp = myList" does is to create a new *reference* to the very same list object. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Is len() restricted to (positive) 32-bit values?

2005-12-29 Thread Jean-Paul Calderone
bit processor, and Python ints appear to be 64-bit as well, so even >if len() only works with ints, it should still be able to handle 64-bit >values. Conspicuous timing: <http://mail.python.org/pipermail/python-dev/2005-December/059266.html> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python as a Server vs Running Under Apache

2006-01-01 Thread Jean-Paul Calderone
seHTTPServer in the standard library will address /this/ particular issue (there are lots of other solutions, too, not just these four). Some of them may address other issues better or worse than others. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading for a newbie

2006-01-05 Thread Jean-Paul Calderone
he list calling join on each one. join will block until the thread's function returns. > > # How do I print "order" after all the threads are complete? > print "\nThreads were processed in the following order:" > for i, person in enumerate(order): print "%d. %s" % (i+1,person) > >if __name__ == "__main__": > main() > Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Spelling mistakes!

2006-01-06 Thread Jean-Paul Calderone
ne 10, in testSomeName self.assertEquals(x.someName, "bye") twisted.trial.unittest.FailTest: 'hello' != 'bye' - Ran 1 tests in 0.278s FAILED (failures=1) [EMAIL PROTECTED]:~$ Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: question about mutex.py

2006-01-06 Thread Jean-Paul Calderone
d -- hence the funny interface for lock, where a function is called once the lock is aquired. If you are looking for a mutex suitable for multithreaded use, see the threading module. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling foreign functions from Python? ctypes?

2006-01-06 Thread Jean-Paul Calderone
its" or "license" for more information. >>> import sys >>> sys.setrecursionlimit(10) __main__:1: DeprecationWarning: integer argument expected, got float >>> (lambda f: f(f))(lambda f: f(f)) Segmentation fault [EMAIL PROTECTED]:~$ I could probably dig up a few more, if you want. So what's ctypes on top of this? Jean-Paul > >Neil >-- >http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list

Re: Failing unittest Test cases

2006-01-10 Thread Jean-Paul Calderone
It's important to keep the two kinds of tests separate. Integration tests are great for telling you that something has gone wrong, but if you get rid of all your unit tests in the process of writing integration tests, you will have a more difficult time determining *what* has gone wrong. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I test if an argument is a sequence or a scalar?

2006-01-10 Thread Jean-Paul Calderone
r, it won't work for anything: >>> iter(5) Traceback (most recent call last): File "", line 1, in ? TypeError: iteration over non-sequence This is "duck typing" in action. Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Marshal Obj is String or Binary?

2006-01-14 Thread Jean-Paul Calderone
#x27;) will do the same job without the security >hole: Using marshal at all introduces a similar security hole, so security is not an argument against repr()/eval() in this context. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: proposal: another file iterator

2006-01-15 Thread Jean-Paul Calderone
re a multiple of the filesystem block size, would it guarantee reads on block-boundaries (where possible)? * How would it handle EOF? Would it stop iterating immediately after the first short read or would it wait for an empty return? * What would the buffering behavior be? Could one interlea

Re: Space left on device

2006-01-16 Thread Jean-Paul Calderone
e on a platform with statvfs(2): >>> import os >>> s = os.statvfs('/') >>> s.f_bavail * s.f_bsize 59866619904L >>> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: magical expanding hash

2006-01-17 Thread Jean-Paul Calderone
+ a else: a = _x else: a = b + a else: if hasattr(a, '__iadd__'): _x = a.__iadd__(b) if _x is NotImplemented: a = b + a else: a = _x else: a = b + a Roug

Re: Simultaneous connections

2006-01-20 Thread Jean-Paul Calderone
On 20 Jan 2006 06:01:15 -0800, datbenik <[EMAIL PROTECTED]> wrote: >How can i write a program that supports simultaneous multipart >download. So i want to open multiple connections to download one file. >Is this possible. If so, how? http://twistedmatrix.com/ > >-- >http://mail.python.org/mailman

Re: Warning when new attributes are added to classes at run time

2006-07-19 Thread Jean-Paul Calderone
s, they will fail and you will know you need to fix your code. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How to force a thread to stop

2006-07-24 Thread Jean-Paul Calderone
ple: thread receives a >message, stops everything, and processes the message. > And what happens if the thread was halfway through a malloc call and the data structures used to manage the state of the heap are in an inconsistent state when the interrupt occurs? This has been discussed m

Re: How to force a thread to stop

2006-07-24 Thread Jean-Paul Calderone
On Mon, 24 Jul 2006 13:51:07 -0700, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: >> On Mon, 24 Jul 2006 11:22:49 -0700, "Carl J. Van Arsdall" <[EMAIL >> PROTECTED]> wrote: >> >>> Steve Ho

Re: micro authoritative dns server

2006-07-24 Thread Jean-Paul Calderone
esolv.conf then the browsers only >recognize the hosts we want Twisted includes a DNS server which is trivially configurable to perform this task. Take a look. http://twistedmatrix.com/ http://twistedmatrix.com/projects/names/documentation/howto/names.html Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Q: Class Privacy (or lack of)

2006-07-24 Thread Jean-Paul Calderone
the solution is simple: don't do things like this ;) It is allowed at all because, to the runtime, "x.someattr = someval" is no different from "self.someattr = someval". The fact that a different name is bound to a particular object doesn't matter. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Stack trace in C

2006-07-25 Thread Jean-Paul Calderone
ack >a backtrace in case of errors in the python code. I think you'd have more luck with the traceback module, which has such methods as format_exception and print_tb. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How to force a thread to stop

2006-07-25 Thread Jean-Paul Calderone
ising an exception in your own thread is pretty trivial. SIGALRM does no good whatsoever here. :) Besides, CPython will only raise exceptions between opcodes. If a misbehaving thread hangs inside an opcode, you'll never see the exception from SIGALRM. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python stack trace on blocked running script.

2006-07-25 Thread Jean-Paul Calderone
.gmane.org/gmane.comp.python.devel/82129 Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Need a compelling argument to use Django instead of Rails

2006-07-26 Thread Jean-Paul Calderone
;>> list.append = lambda self, value: 'hello, world' >>>> x = [] >>>> x.append(10) 'hello, world' >>>> x [] >>>> As alternate implementations become more widely used, it will be important to nail down ex

Re: How to force a thread to stop

2006-07-27 Thread Jean-Paul Calderone
combined with the fact that in Python you /still/ cannot handle a signal until the interpreter is ready to let you do so (a fact that seems to have been ignored in this thread repeatedly), signals end up not being a solution to this problem. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How to force a thread to stop

2006-07-27 Thread Jean-Paul Calderone
try: return threading.Thread.run(self) except Exception, e: print 'Exiting', e def main(): threads = [] for f in timeSleep, childSleep, catchException: t = KillableThread(target=f) t.start() threads.a

Re: Info on continuations?

2006-08-08 Thread Jean-Paul Calderone
p but lead to misunderstandings. >to *really* suspend the stack at a given time and do a bunch of crazy >stuff, but doesn't currently support 'full continuations'. > Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: do people really complain about significant whitespace?

2006-08-09 Thread Jean-Paul Calderone
l don't think meaningful indentation is good. If your example were actually valid (which it isn't), all it would demonstrate is that Python should be even stricter about indentation, since it would have meant that there is still some whitespace which has no meaning and therefore can be adjusted in meaingless ways by each programmer, resulting in unreadable junk. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: start a multi-sockets server (a socket/per thread) with different ports but same host

2006-08-12 Thread Jean-Paul Calderone
k when all the other # Deferreds in this list have been called back. d = defer.DeferredList(completionDeferreds) # And tell it to stop the reactor when it fires d.addCallback(lambda result: allConnectionsLost()) # Start the reactor so things can start happening reactor.ru

Re: self=pickle.load(file)? (Object loads itself)

2006-08-12 Thread Jean-Paul Calderone
thod(fromPickleFile) You can then use this like so: inst = Obj.fromPickleFile('obj.dat') Jean-Paul > >Anton >-- >http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list

Re: start a multi-sockets server (a socket/per thread) with different ports but same host

2006-08-12 Thread Jean-Paul Calderone
On 12 Aug 2006 10:44:29 -0700, zxo102 <[EMAIL PROTECTED]> wrote: >Jean-Paul, >Thanks a lot. The code is working. The python twisted is new to me too. >Here are my three more questions: >1. Since the code need to be started in a wxpyhon GUI (either by >clicking a button or up

Re: start a multi-sockets server (a socket/per thread) with different ports but same host

2006-08-13 Thread Jean-Paul Calderone
On 12 Aug 2006 21:59:20 -0700, zxo102 <[EMAIL PROTECTED]> wrote: >Jean-Paul, >I just start to learn Twisted. Here is my simple case: I can find >the data sent by clients in dataReceived but I don't know which >client/which port the data is from. After I know where the

Re: How to tell machines endianism.

2006-08-15 Thread Jean-Paul Calderone
On 15 Aug 2006 10:06:02 -0700, KraftDiner <[EMAIL PROTECTED]> wrote: >How can you tell if the host processor is a big or little endian >machine? > sys.byteorder Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Anyone have a link handy to an RFC 821 compliant email address regex for Python?

2006-08-16 Thread Jean-Paul Calderone
nd from google searches are not really as >> robust as I need them to be. > >Would email.Utils.parseaddr() fit the bill? > >http://docs.python.org/lib/module-email.Utils.html#l2h-3944 > This is for RFC 2822 addresses. http://divmod.org/trac/browser/sandbox/exarkun/smtp.

Re: socket client server... simple example... not working...

2006-10-04 Thread Jean-Paul Calderone
buf = '' def dataReceived(self, bytes): self.buf += bytes exit = self.buf.find('exit') if exit != -1: self.transport.write(self.buf[:exit]) self.buf = self.buf[exit + 4:] reactor.stop() else: self.transport.write(self.buf) self.buf = '' f = protocol.ServerFactory() f.protocol = Server reactor.listenTCP('192.168.1.101', 8080, f) reactor.run() Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: socket client server... simple example... not working...

2006-10-05 Thread Jean-Paul Calderone
On 5 Oct 2006 07:01:50 -0700, SpreadTooThin <[EMAIL PROTECTED]> wrote: > [snip] > >Jean-Paul many thanks for this and your effort. >but why is it every time I try to do something with 'stock' python I >need another package? Maybe you are trying to do things that a

weakSet

2006-10-05 Thread jean . philippe . mague
unsupported operand type(s) for &: 'set' and 'instance' the hard olution would add the following behavior: >>>(s&ws).__class__() is WeakSet True Any hint for the easy solution ? for the hard one ? Jean-Philippe -- http://mail.python.org/mailman/listinfo/python-list

Re: Restoring override of urllib.URLopener.open_https

2006-10-05 Thread Jean-Paul Calderone
and AFAIK, the original urllib >code is irreversibly overwritten. Am I right? Mostly. However, Try importing urllib first, grabbing the open_https function, then importing M2Crypto, then reversing what M2Crypto did by putting the original open_https function back onto URLopener. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 342 misunderstanding

2006-10-08 Thread Jean-Paul Calderone
opIteration: ... break ... 0 2 4 6 8 10 12 14 16 18 > >Now, I was expecting that to be 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20. > >What am I missing here? Your code was calling next and send, when it should have only been calling send. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: can regular ol' python do a php include?

2006-10-10 Thread Jean-Paul Calderone
7;header.html').read() > >Not quite as elegant as include('header.html'), but it seems like it >would work. def include(filename): print open(filename).read() include('header.html') Behold, the power of a general purpose programming language. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: trying to twist my head around twisted (and python)

2006-10-11 Thread Jean-Paul Calderone
uccessful result. If all of your processing is synchronous, then you simply need to return twisted.internet.defer.succeed(None) at the end of the function. If you have asynchronous processing to do (it does not appear as though you do), you will need to return a Deferred which only fires once that processing has been completed. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting existing module/objects to threads

2006-10-19 Thread Jean-Paul Calderone
check the current time against the top element's time. You could also use Twisted, which provides time-based primitives in addition to supporting network multiplexing without threads. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: trying to twist my head around twisted (and python)

2006-10-20 Thread Jean-Paul Calderone
On Fri, 13 Oct 2006 18:44:35 +0200, Jan Bakuwel <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: > >> The return value of eomReceived is used to determine whether to signal to >> the SMTP client whether the message has been accepted. Regardless of your >>

Re: ZODB and Python 2.5

2006-10-20 Thread Jean-Paul Calderone
on the relevant mailing list for people talking about using ZODB with >Python 2.5. > >2) Just try it. Install Python 2.5 alongside 2.4, install ZODB, run the test >suite. > These are pretty good suggestions, though, particularly the latter. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: curious paramstyle qmark behavior

2006-10-20 Thread Jean-Paul Calderone
interpolation mechanism. Typically, you cannot use them with database, table, or column names. Likewise, this won't work: execute("SELECT foo ? bar WHERE baz", ("FROM",)) The rule is difficult to express simply (at least, I have never seen it expressed simply), but it goes something like "bind parameters only work on values, not schema elements or syntactic constructs". Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Attempting to parse free-form ANSI text.

2006-10-21 Thread Jean-Paul Calderone
/originalgamer.cvs.sourceforge.net/originalgamer/originalgamer/originalgamer/ansi.py?revision=1.12&view=markup may be of some interest. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Socket module bug on OpenVMS

2006-10-22 Thread Jean-Paul Calderone
and it probably even makes sense to recommend the high-level interface for most applications). Python doesn't always do a good job of keeping the high and low levels separate though, and this seems like an area in which Python could stand some improvement. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Socket module bug on OpenVMS

2006-10-22 Thread Jean-Paul Calderone
On Sun, 22 Oct 2006 19:58:44 +0200, Irmen de Jong <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: >> I think everyone can agree that Python shouldn't crash. > >Well, it doesn't really crash in a bad way, in my example: >it doesn't work because it s

Re: Socket module bug on OpenVMS

2006-10-22 Thread Jean-François Piéronne
se > workarounds. That would make user code a lot cleaner and less > error prone, and more portable. What do other people think? > > > Regards > --Irmen de Jong Jean-Francois Pieronne -- http://mail.python.org/mailman/listinfo/python-list

Re: Socket module bug on OpenVMS

2006-10-22 Thread Jean-François Piéronne
Irmen de Jong a écrit : > Jean-François Piéronne wrote: > >> Which Python version, OpenVMS version, IP stack and stack version? > > OpenVMS 7.3-2, Python 2.3.5, no idea about IP stack version. > Thanks, may be upgrade to Python 2.5 will solve the problem. >> If yo

Re: Socket module bug on OpenVMS

2006-10-24 Thread Jean-François Piéronne
Irmen de Jong wrote: > Martin v. Löwis wrote: [snip] >> Perhaps you had some different work-around in mind? > > Nope, I was indeed thinking about splitting up the recv() into > smaller blocks internally. > Maybe a more elaborate check in Python's build system (to remove > the MSG_WAITALL on VMS) w

Re: Tracing the execution of scripts?

2006-10-26 Thread Jean-Paul Calderone
oop you'll find debugging and testing much easier. 4) Use an existing library instead of developing a new one. 5) (Only included so I don't look like a _complete_ jerk. If you get this far and you haven't fixed the problem yet, consider this a booby prize.) http://divmod.org/trac/browser/trunk/Epsilon/epsilon/spewer.py Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Telnetlib to twisted

2006-10-27 Thread Jean-Paul Calderone
hand, if all you do is write them to stdout, your actual terminal should handle them. You'll only need an extra layer if you want to do extra interpretation. Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Event driven server that wastes CPU when threaded doesn't

2006-10-29 Thread Jean-Paul Calderone
?: >http://twistedmatrix.com/documents/current/api/twisted.python.dispatch.EventDispatcher.html Note, however: >>> from twisted.python import dispatch __main__:1: DeprecationWarning: Create your own event dispatching mechanism, twisted.python.dispatch will soon be no more. Take a look at <http://twistedmatrix.com/documents/current/api/twisted.enterprise.adbapi.html>. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: beginner's refcount questions

2006-10-29 Thread Jean-Paul Calderone
;> raise ValueError collected Traceback (most recent call last): File "", line 1, in ? ValueError >>> > >And some other minor question: Is there a way to query the use count >of an object? This would be useful for debugging and testing. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Event driven server that wastes CPU when threaded doesn't

2006-10-31 Thread Jean-Paul Calderone
;> Is the only solution to use a threaded server to let my clients make >> their requests and receive a response in the fastest possible time? > >Maybe. Probably not. It's all good -- multi-threading is your friend. > Multithreading is _someone's_ friend. Probably not the OP'

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-02 Thread Jean-Paul Calderone
but I would expect it does too. Are you certain you need this complexity? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-02 Thread Jean-Paul Calderone
On Thu, 2 Nov 2006 14:15:58 -0500, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >On Thu, 02 Nov 2006 19:32:54 +0100, robert <[EMAIL PROTECTED]> wrote: >>I'd like to use multiple CPU cores for selected time consuming Python >>computations (incl. numpy/scipy) in

Re: Physical constants

2006-11-03 Thread Jean-Paul Calderone
that would probably benefit from something more correct than what's at the above URL. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-16 Thread Jean-Paul Calderone
o find out what specific file name is causing the problem >(whereas when listdir failed completely, you could not easily find > out the cause of the failure). > >How would you propose listdir should behave? Umm, just a wild guess, but how about raising an exception which includes the name of the file which could not be decoded? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: TIming

2006-05-30 Thread Jean-Paul Calderone
nd don't deserve outbursts like this one, regardless of what you think of their responses. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Starting New Process

2006-06-01 Thread Jean-Paul Calderone
/setsid', ['setsid', '/usr/bin/vi']) self.transport.loseConnection() f = protocol.ServerFactory() f.protocol = ViRunner reactor.listenTCP(, f) reactor.run() Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: transfer rate limiting in socket.py

2006-06-16 Thread Jean-Paul Calderone
> Anybody think this would be fun? Use Twisted instead. It supports every protocol you mentioned, and rate limiting too. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Legitimate use of the "is" comparison operator?

2006-06-17 Thread Jean-Paul Calderone
me size!" >else: >print "They're not the same size!" > No, this is wrong. >>> a = range(100) >>> b = range(100) >>> len(a) is len(b) False Use "is" to determine if two variables refer to exactly the same object, never to determine if two objects are equal. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: mapping None values to ''

2006-06-18 Thread Jean-Paul Calderone
... s[vbl] = '' > Hey Tim, Actually this doesn't work for locals at all: >>> def f(): ... x = 'x' ... locals()['x'] = 'y' ... print x ... >>> f() x >>> Locals cannot be mod

Re: Network Programming in Python

2006-06-22 Thread Jean-Paul Calderone
ands for it to run. Of course, xterm isn't a very good win32 program to run but I couldn't think of a better example. You could also write a program to send command requests to this server, instead of using telnet. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with sets and Unicode strings

2006-06-29 Thread Jean-Paul Calderone
s which use this feature and go to the trouble of modifying your own site.py for them, you won't be able to, since there can only be one default system encoding. Only one will be able to work at a time. The default encoding is ascii and should always be ascii. If you want another encoding, specify it in a call to .encode() or .decode(). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Import bug: Module executed twice when imported!

2006-06-30 Thread Jean-Paul Calderone
ted subtest.imptest. Since the first imptest was imported by the name imptest, subtest.imptest was determined to be a different module and re-executed. Set __name__ to 'subtest' as it would be if you had really imported subtest and the import system will correctly name the modules, causing imptest to be imported only once. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: gmail/poplib: quickly detecting new mail

2006-07-01 Thread Jean-Paul Calderone
much difference. If you look at the capabilities gmail's POP3 server publishes, you even see they are declaring a five minute login delay. This is intended as a hint to clients that logins more frequent than one per five minutes are not allowed. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading HowTo's in Windows platforms

2006-07-01 Thread Jean-Paul Calderone
uot; would be great as I am >a "baby python" who is very green with threading.. Threaded programming is extremely difficult. Most good newbie introductions to it consist of warnings not to use it. Do you have a particular application in mind? Perhaps someone can suggest a more spec

Re: Out of the box database support

2006-07-03 Thread Jean-Paul Calderone
i.e. MySQL. See these Python 2.5 docs: http://docs.python.org/dev/lib/module-sqlite3.html Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing and Rendering rfc8222

2006-07-04 Thread Jean-Paul Calderone
i.list.org/display/DEV/Summer+of+Code > Just pointing out that there is no RFC 8222. I assume you mean RFC 2822. I wouldn't mention it but this mistake is repeated several times on the wiki page. Jean-Paul http://divmod.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-06 Thread Jean-Paul Calderone
escribe them in more detail (for example, what does "high performance" mean to you?) someone can make a more useful recommendation. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: threading troubles

2006-07-10 Thread Jean-Paul Calderone
ted.internet import reactor def main(): reactor.spawnProcess( None, '/usr/bin/fluidsynth', ['fluidsynth', '-ni', '/home/mysndfont.sf2', 'mymidi.mid']) reactor.run() Your Gtk app won't block and you won't have to worry about the threading/forking/signal interaction that is messing you up now. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: get a line of text from a socket...

2006-08-25 Thread Jean-Paul Calderone
def lineReceived(self, line): print 'Received line:', repr(line) factory = protocol.ServerFactory() factory.protocol = LineEcho reactor.listenTCP(12345, factory) reactor.run() Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How to store ASCII encoded python string?

2006-08-28 Thread Jean-Paul Calderone
Another solution which might be better is to select a data type for this column which can handle arbitrary bytes. This will let you avoid mangling the input completely. Different databases have different column types for handling this. For PostreSQL, you might want to look at BYTEA. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Generator chaining?

2006-08-29 Thread Jean-Paul Calderone
sible to do something similar with >generators. The best way to explain is by code example: > >def add_generators(gen1, gen2): >for x in gen1: >yield x >for y in gen2: >yield y > >Just a thought... You can chain any iterators using itertools.chain(

Re: Naming conventions (was: Re: refering to base classes)

2006-08-29 Thread Jean-Paul Calderone
t;denotes the name of an *instance*, in contrast to a *class* which is >named with TitleCase. > >The camelCase style is less popular in the Python world, where (as per >PEP 8) instances are named with all lower case, either joinedwords or >separate_by_underscores. Not that this pre

Re: Newbie question involving buffered input

2006-09-01 Thread Jean-Paul Calderone
input. The flush method only relates to output. The *other* side of the file has to flush *its* output in order for you to see it as input. On Linux, the termios module provides a way to tell the system not to do any buffering on a file descriptor. pywin32 may expose equivalent functionality for W

Re: Twisted vs POS (Plain-old sockets)

2006-09-03 Thread Jean-Paul Calderone
t. It will speed up your development time and reduce the amount of defects you need to deal with. It will > >If it makes a difference: Depending on performance parts of this app may >well >end up as a prototype for a final (...alternative?) C++ implementation. > >Thanks for consideration, Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python style: to check or not to check args and data members

2006-09-03 Thread Jean-Paul Calderone
56623L, None) > >>> class A(object): >... def __getitem__(self, s): >... print s >... > >>> A()[0:3**33] >slice(0, 555906056623L, None) > >>> Note that it _does_ happen with current [EMAIL PROTECTED]: Python 2.6a0 (trunk:51698M, Sep 3 2006, 12:40:55) [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> slice(0, 3 ** 33) slice(0, 555906056623L, None) >>> class x: ... def __getitem__(self, idx): print idx ... >>> x()[:3**33] slice(0, 2147483647, None) >>> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: str.isspace()

2006-09-03 Thread Jean-Paul Calderone
use it, so if most people don't use it, then it may be removed from Py 3.0. If you really need division, you may use: x * (y ** -1) Bye, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite 'ownership' problems

2006-09-03 Thread Jean-Paul Calderone
by that fact that I have since written one Py script (in >IDLE) which creates and populates a db, and another that can retrieve >the data. But... Just make sure everyone who should be able to read and write the database has read and write permissions on the database file. Nothing more is necessary. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: threading support in python

2006-09-04 Thread Jean-Paul Calderone
at while they are blocked on the network or the disk, another thread can continue to execute. Extension modules which perform computationally intensive tasks can also release the GIL to allow better exploitation of SMP resources. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Prevent self being passed to a function stored as a member variable?

2006-09-04 Thread Jean-Paul Calderone
le "", line 1, in ? TypeError: () takes no arguments (1 given) >>> In which case, staticmethod() is actually the solution you want: >>> class w(object): ... w = staticmethod(lambda: None) ... >>> w().w() >>> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Twisted vs POS (Plain-old sockets)

2006-09-04 Thread Jean-Paul Calderone
I just prefer specific to non-specific. Hope to see you over on the Twisted list, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: asyncore.dispatcher stops listening

2006-09-04 Thread Jean-Paul Calderone
) > File "/usr/local/lib/python2.4/asyncore.py", line 122, in poll >r, w, e = select.select(r, w, e, timeout) >KeyboardInterrupt What does /proc/ say about the server's open file descriptors? What about r, w, e, and timeout? What are their values? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: threading support in python

2006-09-05 Thread Jean-Paul Calderone
alf as much time were spent cutting code as is spent discussing the matter, we might learn if there were any value in doing so. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: threading support in python

2006-09-05 Thread Jean-Paul Calderone
itly shows the semantics actually desired. Not that >"huge" a benefit as far as I can tell. Lisp programmers have gotten >along fine without it for 40+ years... Uh yea. No lisp programmer has ever written a with-* function... ever. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: threading support in python

2006-09-06 Thread Jean-Paul Calderone
or change. There is no such guarantee right now; there is just an >implementation artifact in CPython that has led to careless habits >among some users. Actually, there is an API for instructing the GC how frequently to run, in addition to the explicit API for causing the GC to run when you invoke it. See the gc module for more information. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: A static pychecker?

2006-09-08 Thread Jean-Paul Calderone
oesn't require modules to be importable to examine them and it is significantly faster. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

<    3   4   5   6   7   8   9   10   11   12   >