Re: curious paramstyle qmark behavior

2006-10-20 Thread Jean-Paul Calderone
On 20 Oct 2006 13:06:58 -0700, BartlebyScrivener <[EMAIL PROTECTED]> wrote: >With > >aColumn = "Topics.Topic1"' > >The first statement "works" in the sense that it finds a number of >matching rows. > >c.execute ("SELECT Author, Quote, ID, Topics.Topic1, Topic2 FROM >QUOTES7 WHERE " + aColumn + " LI

Re: Attempting to parse free-form ANSI text.

2006-10-21 Thread Jean-Paul Calderone
On Sun, 22 Oct 2006 00:34:14 -0400, "Michael B. Trausch" wrote: >Alright... I am attempting to find a way to parse ANSI text from a >telnet application. However, I am experiencing a bit of trouble. > >What I want to do is have all ANSI sequences _removed_ from the output, >save for those that man

Re: Socket module bug on OpenVMS

2006-10-22 Thread Jean-Paul Calderone
On Sun, 22 Oct 2006 19:00:22 +0200, Irmen de Jong <[EMAIL PROTECTED]> wrote: >Hi, > >Recently I was bitten by an apparent bug in the BSD socket layer >on Open VMS. Specifically, it appears that VMS defines MSG_WAITALL >in socket.h but does not implement it (it is not in the documentation). >And I u

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: Tracing the execution of scripts?

2006-10-26 Thread Jean-Paul Calderone
On Thu, 26 Oct 2006 21:52:42 -0400, "Michael B. Trausch" wrote: >Alright, I seem to be at a loss for what I am looking for, and I am not >even really all that sure if it is possible or not. I found the 'pdb' >debugger, but I was wondering if there was something that would trace or >log the order

Re: Telnetlib to twisted

2006-10-27 Thread Jean-Paul Calderone
On Fri, 27 Oct 2006 16:40:44 +0100, Matthew Warren <[EMAIL PROTECTED]> wrote: >Hallo, > import telnetlib l=telnetlib.Telnet('dbprod') l.interact() >telnet (dbprod) > >Login: > > >Could anyone show how the above would be written using the twisted >framework? All I'm after is a more 'i

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

2006-10-29 Thread Jean-Paul Calderone
On 29 Oct 2006 13:13:32 -0800, Nick Vatamaniuc <[EMAIL PROTECTED]> wrote: >Snor wrote: >> I'm attempting to create a lobby & game server for a multiplayer game, >> and have hit a problem early on with the server design. I am stuck >> between using a threaded server, and using an event driven server

Re: beginner's refcount questions

2006-10-29 Thread Jean-Paul Calderone
On 30 Oct 2006 00:30:53 +, Jens Theisen <[EMAIL PROTECTED]> wrote: >Hello, > >python uses gc only where refcounts alone haven't yet done the >job. Thus, the following code > >class Foo: >def __del__(self): >print "deled!" > >def foo(): >f = Foo() > >foo() >print "done!" > >print

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

2006-10-31 Thread Jean-Paul Calderone
On Tue, 31 Oct 2006 07:33:59 GMT, Bryan Olson <[EMAIL PROTECTED]> wrote: >Snor wrote: >> I'm attempting to create a lobby & game server for a multiplayer game, >> and have hit a problem early on with the server design. I am stuck >> between using a threaded server, and using an event driven server.

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

2006-11-02 Thread Jean-Paul Calderone
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 a frictionless manner. NumPy releases the GIL in quite a few places. I haven't used scipy much, but I would expect it

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
On Fri, 3 Nov 2006 18:57:49 -0500, Tommy Grav <[EMAIL PROTECTED]> wrote: >I have some code for doing orbital computations. The code is kind of >extensive with many classes, each having several functions. In these >functions I need to use constants (like the gravitational constant). >What is the bes

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

2006-11-16 Thread Jean-Paul Calderone
On Fri, 17 Nov 2006 00:31:06 +0100, "\"Martin v. Löwis\"" <[EMAIL PROTECTED]> wrote: >gabor schrieb: >>> All this code will typically work just fine with the current behavior, >>> so people typically don't see any problem. >>> >> >> i am sorry, but it will not work. actually this is exactly what i

Re: TIming

2006-05-30 Thread Jean-Paul Calderone
On Tue, 30 May 2006 14:50:38 -0500, WIdgeteye <[EMAIL PROTECTED]> wrote: > > [snip] > >This PYTHON NG blows to high heaven. Whats worse, the answers I got were >most likely from people who know SQUAT about Python scripting. That's why >they gave me such lame fucking answers. > >Idiots. While that

Re: Starting New Process

2006-06-01 Thread Jean-Paul Calderone
On 1 Jun 2006 07:34:23 -0700, D <[EMAIL PROTECTED]> wrote: >Hello, I need to write a server program that performs the following >tasks: > >1) Listens on TCP port for a connection >2) When client connects, launches application (for example, vi), then >closes connection with client >3) Goes b

Re: transfer rate limiting in socket.py

2006-06-16 Thread Jean-Paul Calderone
On 16 Jun 2006 13:53:48 -0700, Peter Silva <[EMAIL PROTECTED]> wrote: >Hi folks, > >I have a need in a network data distribution application to send out >data to folks who want it using the protocol of their choice. I´d >like it to support a variety of protocols and I don´t want to >implement any

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

2006-06-17 Thread Jean-Paul Calderone
On 17 Jun 2006 00:49:51 -0700, Mike Duffy <[EMAIL PROTECTED]> wrote: >I just recently realized that the comparison operator "is" actually >works for comparing numeric values. Now, I know that its intended use >is for testing object identity, but I have used it for a few other >things, such as type

Re: mapping None values to ''

2006-06-18 Thread Jean-Paul Calderone
On Sun, 18 Jun 2006 07:37:00 -0500, Tim Chase <[EMAIL PROTECTED]> wrote: >> i wish to map None or "None" values to "". >> eg >> a = None >> b = None >> c = "None" >> >> map( , [i for i in [a,b,c] if i in ("None",None) ]) >> >> I can't seem to find a way to put all values to "". Can anyone help?

Re: Network Programming in Python

2006-06-22 Thread Jean-Paul Calderone
On 22 Jun 2006 12:02:14 -0700, [EMAIL PROTECTED] wrote: >I am a newbie in python. I want to learn and implement a small >networking concept. Please help me. Every help is appreciated. > >I have one Linux Box and one Windows PC. I want to have a daemon >running on Windows PC which listens on some sp

Re: Problem with sets and Unicode strings

2006-06-29 Thread Jean-Paul Calderone
On Thu, 29 Jun 2006 21:19:30 +0200, Dennis Benzinger <[EMAIL PROTECTED]> wrote: >Robert Kern wrote: >> Dennis Benzinger wrote: >>> Ok, I understand. >>> But isn't it a (minor) problem that using a set like this: >>> >>> # -*- coding: UTF-8 -*- >>> >>> FIELDS_SET = set(("Fächer", )) >>> >>> print u"

Re: Import bug: Module executed twice when imported!

2006-06-30 Thread Jean-Paul Calderone
On Fri, 30 Jun 2006 19:13:00 +0100, Michael Abbott <[EMAIL PROTECTED]> wrote: >Bump > >In article <[EMAIL PROTECTED]>, > Michael Abbott <[EMAIL PROTECTED]> wrote: > >> --- test.py --- >> import imptest >> execfile('subtest.py', dict(__name__ = 'subtest.py')) >> --- imptest.py --- >> print 'Imptest

Re: gmail/poplib: quickly detecting new mail

2006-07-01 Thread Jean-Paul Calderone
On 1 Jul 2006 08:29:51 -0700, LJ <[EMAIL PROTECTED]> wrote: >Hello, > >I'm trying to monitor my gmail account to know when I have obtained a >new email. It seems that once I have logged in, I should be able to >call the stat() function repeatedly to see how many messages are in my >inbox. The pro

Re: Threading HowTo's in Windows platforms

2006-07-01 Thread Jean-Paul Calderone
On Sat, 01 Jul 2006 16:36:02 GMT, LittlePython <[EMAIL PROTECTED]> wrote: >I am looking for some good beginner how-to links and maybe some simple >example scripts that perform threading on windows platforms. Hopefully >authors who don't mind doing "a little spoon feeding" would be great as I am >a

Re: Out of the box database support

2006-07-03 Thread Jean-Paul Calderone
On Mon, 3 Jul 2006 13:41:24 +0100, Alex Biddle <[EMAIL PROTECTED]> wrote: >Hey there. > >I was wondering whether Python had any support out-of-the-box for >database functionality, or database-like functionality. > >For instance a lot of shared hosts have Python installed, but not the >MySQL extensi

Re: Parsing and Rendering rfc8222

2006-07-04 Thread Jean-Paul Calderone
On Tue, 04 Jul 2006 15:44:03 -0400, emf <[EMAIL PROTECTED]> wrote: >Dearest mail manipulating macaques and perambulating python >prestidigitators, > >I have been blessed by the grace of Google and so am working full-time >on improving Mailman's web UI: > >http://wiki.list.org/display/DEV/Summer+of+

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

2006-07-06 Thread Jean-Paul Calderone
On Thu, 6 Jul 2006 09:36:25 -0700, Jack <[EMAIL PROTECTED]> wrote: >Basically I am trying to find a high performance web server. Since >Python is installed on all of the servers, It'll be great if the web >server is written in Python as well. Otherwise, I will have to install >lighttpd or other web

Re: threading troubles

2006-07-10 Thread Jean-Paul Calderone
On Mon, 10 Jul 2006 11:29:37 +, sreekant <[EMAIL PROTECTED]> wrote: >Hi folks > >What am I doing wrong in the following? I just want to run fluidsynth in >the background. ># >class MyThread(threading.Thread): > def __init__(self, cmd, callback): >

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

2006-08-25 Thread Jean-Paul Calderone
On 25 Aug 2006 09:37:09 -0700, KraftDiner <[EMAIL PROTECTED]> wrote: >If you don't know how long your input data is going to be how can you >at least treat it a text line at a time... like looking for new line in >the data... Right now recv blocks. Yes I could do a select, but the >examples seem

Re: How to store ASCII encoded python string?

2006-08-28 Thread Jean-Paul Calderone
On 28 Aug 2006 13:51:58 -0700, [EMAIL PROTECTED] wrote: >Fredrik Lundh wrote: >> 3) convert the data to Unicode before passing it to the database >> interface, and leave it to the interface to convert it to whatever >> encoding your database uses: >> >> data = ... get encoded string from email

Re: Generator chaining?

2006-08-29 Thread Jean-Paul Calderone
On Tue, 29 Aug 2006 22:41:37 +0300, John Doe <[EMAIL PROTECTED]> wrote: >This is sort of a feature request/idea: Chaining generators. > >If you have two lists (or tuples) and you add them, the result is a >concatenation of the two. >I think it would be nice if it was possible to do something simila

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

2006-08-29 Thread Jean-Paul Calderone
On Wed, 30 Aug 2006 14:22:16 +1000, Ben Finney <[EMAIL PROTECTED]> wrote: >"glenn" <[EMAIL PROTECTED]> writes: > >> Bruno Desthuilliers wrote: >> > It might be better to use newstyle classes if you can. Also, the >> > convention is to use CamelCase for classes names (unless you have >> > a strong r

Re: Newbie question involving buffered input

2006-09-01 Thread Jean-Paul Calderone
On Fri, 1 Sep 2006 09:31:11 -0700, Caolan <[EMAIL PROTECTED]> wrote: >I am executing the code below on a Windows XP system and if I enter > 2 >characters it buffers the input and the call to sys.stdin.flush does not flush >the input, it remains buffered. You cannot flush input. The flush method

Re: Twisted vs POS (Plain-old sockets)

2006-09-03 Thread Jean-Paul Calderone
On Sun, 3 Sep 2006 00:19:17 -0700, Darren Kirby <[EMAIL PROTECTED]> wrote: >Hey all, > >I have a (FOSS) project here that I am about to start that requires TCP >networking support, and in fact, will require me to design and implement a >(text based) protocol from scratch. I'm sorry. > >I have bee

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

2006-09-03 Thread Jean-Paul Calderone
On Sun, 03 Sep 2006 16:29:11 +0200, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Paul Rubin a écrit : >> Bruno Desthuilliers <[EMAIL PROTECTED]> writes: >> >>>I've rarely encoutered "silent" data corruption with Python - FWIW, I >>>once had such a problem, but with a lower-level statically type

Re: str.isspace()

2006-09-03 Thread Jean-Paul Calderone
On 3 Sep 2006 09:20:49 -0700, [EMAIL PROTECTED] wrote: >Are you using the str.isspace() method? I don't use it, so if most >people don't uses it, then it may be removed from Py 3.0. > >I usually need to know if a string contains some non-spaces (not space >class chars). To do it I use something lik

Re: sqlite 'ownership' problems

2006-09-03 Thread Jean-Paul Calderone
On 3 Sep 2006 14:38:51 -0700, rdrink <[EMAIL PROTECTED]> wrote: >I will try to keep this as suscinct as possible as it might be an >obvious Q. >I am just getting into Py/sqlite (with a fair amount of PHP/MySQL >background), and am posting this as much for the other noobs as >myself >I start

Re: threading support in python

2006-09-04 Thread Jean-Paul Calderone
On Mon, 4 Sep 2006 17:48:14 +0200, Sybren Stuvel <[EMAIL PROTECTED]> wrote: >km enlightened us with: >> Is there any PEP to introduce true threading features into python's >> next version as in java? i mean without having GIL. > >What is GIL? Except for the Dutch word for SCREAM that is... > >> whe

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

2006-09-04 Thread Jean-Paul Calderone
On 4 Sep 2006 09:39:32 -0700, Sandra-24 <[EMAIL PROTECTED]> wrote: >How can you prevent self from being passed to a function stored as a >member variable? This doesn't happen: >>> class x: ... def __init__(self): ... self.x = lambda: None ... >>> x().x() >>> class y(object): ...

Re: Twisted vs POS (Plain-old sockets)

2006-09-04 Thread Jean-Paul Calderone
On Mon, 4 Sep 2006 11:40:33 -0700, Darren Kirby <[EMAIL PROTECTED]> wrote: >> As for documentation, many people say it is lacking, but perhaps one person >> in a thousand points out _how_ or _where_ it is lacking. Unfortunately it >> is difficult to improve things (or even determine if they really

Re: asyncore.dispatcher stops listening

2006-09-04 Thread Jean-Paul Calderone
On Mon, 4 Sep 2006 19:03:09 -0700, Daniel Walton <[EMAIL PROTECTED]> wrote: >I have been working on a problem for a full week now. If someone >could please help me it would be great. Even a clue would be great at >this point. What I am seeing is quite a mystery. > >I have server written in pytho

Re: threading support in python

2006-09-05 Thread Jean-Paul Calderone
On 05 Sep 2006 13:19:03 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: >[EMAIL PROTECTED] writes: >> It was removed at one point in the dim, dark past (circa Python 1.4) on an >> experimental basis. Aside from the huge amount of work, it resulted in >> significantly lower performance f

Re: threading support in python

2006-09-05 Thread Jean-Paul Calderone
On 05 Sep 2006 17:31:11 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > > def func(filename): > with open(filename) as f: >do_something_with(f) > # f definitely gets closed when the "with" block exits > >which more explicitly shows the semantics actually desired. Not

Re: threading support in python

2006-09-06 Thread Jean-Paul Calderone
On 06 Sep 2006 13:29:33 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: >"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: >> > We had that debate already (PEP 343). Yes, there is some sloppy >> > current practice by CPython users that relies on the GC to close the >> > db conn. >> >> Thi

Re: A static pychecker?

2006-09-08 Thread Jean-Paul Calderone
On Fri, 8 Sep 2006 08:00:25 -0500, "Edward K. Ream" <[EMAIL PROTECTED]> wrote: >I am wondering whether anyone knows of a static source-code analyzer for >Python, kinda like a static pychecker. > >That is, instead of being a run-time tool as pychecker is, it would be a >'compile-time' tool. If I we

Re: socket question

2006-09-13 Thread Jean-Paul Calderone
On Wed, 13 Sep 2006 08:13:43 -0500, hg <[EMAIL PROTECTED]> wrote: >Hi, > >I am not sure whether this is a python-related question. > >If I have device A than sends XX bytes to device B, and device B does a >recv(XX) using the default timeout, what could make device B wake-up >with less than XX byte

Re: Unit balancing

2006-09-13 Thread Jean-Paul Calderone
On 13 Sep 2006 07:47:41 -0700, [EMAIL PROTECTED] wrote: >Greetings! > >I am working with a researcher who would be very happy if he could >include units in his calculations. Then, if his complicated expression >didn't result in "kg/yr" the program would stop and point out his >error. > >Does Pytho

Re: [Twisted-Python] twisted.web2 and blank values in POST

2006-09-13 Thread Jean-Paul Calderone
On Wed, 13 Sep 2006 17:28:04 +0200, Sylvain Thénault <[EMAIL PROTECTED]> wrote: >Hi there, > >I've found a strange behaviour in twisted web2'server : the behaviour with >blank values >in form parameters is not consistent between GET and POST: on GET blank values >are kept while >this is not the c

Re: [Twisted-Python] twisted.web2 and blank values in POST

2006-09-13 Thread Jean-Paul Calderone
Ugg, wrong list obviously. Please disregard. Sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why not event-driven packages in other than the main thread?

2006-09-14 Thread Jean-Paul Calderone
On Thu, 14 Sep 2006 11:13:59 +0200, Tor Erik <[EMAIL PROTECTED]> wrote: >Hi, > >I've developed an application were I've used Tkinter for the GUI. >When I ran the GUI in another thread than the main, it kept locking >up. >I experienced similar problems with Twisted. > >Both of these tools are event-

Re: UDP packets to PC behind NAT

2006-09-15 Thread Jean-Paul Calderone
On 15 Sep 2006 00:32:49 -0700, Janto Dreijer <[EMAIL PROTECTED]> wrote: >This is probably more of a networking question than a Python one, but >it would be nice to know if someone has done this with Python's socket >module. And besides one usually gets more information from c.l.py than >anywhere el

Re: Priority based concurrent execution

2006-09-21 Thread Jean-Paul Calderone
On 21 Sep 2006 04:56:46 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >Willi Richert wrote: >> Hi, >> >> I have a simulation application (PlayerStage) in which the robot is asked >> every ~200ms for an action. In the meantime the robot has to do some >> calculation with the perception. As

Re: How to return an "not string' error in function?

2006-09-21 Thread Jean-Paul Calderone
On Thu, 21 Sep 2006 09:26:20 -0500, Tim Chase <[EMAIL PROTECTED]> wrote: >> def test(s): >>if type(s) != ? : >> return >> #So here I want establish a situation about that if is not string >> #then , but how should write the ? >> #Or is there any other way to do it? > > >>> isins

Re: threading, subprocesses and wait

2006-09-26 Thread Jean-Paul Calderone
On 26 Sep 2006 06:29:17 -0700, Gal Diskin <[EMAIL PROTECTED]> wrote: >Hi all, >I'm writing a python program using threads to open several subprocesses >concurrently (using module subprocess) and wait on them. I was >wondering if there is a possibilty that a thread will return from wait >even though

Re: preserving color ouput of a shell command via os.popen()

2006-09-26 Thread Jean-Paul Calderone
On 26 Sep 2006 19:07:54 -0700, [EMAIL PROTECTED] wrote: >Hi everyone > >I would like to get the output of a shell process on Linux (eg, "ls >--color=auto") run via os.popen(), filter it and then output parts of >it while preserving any original coloring added by that process. > >Doing > >child = os

Re: Improving telnetlib

2006-10-04 Thread Jean-Paul Calderone
On Wed, 4 Oct 2006 11:19:35 +0100, Matthew Warren <[EMAIL PROTECTED]> wrote: > >Hi, > >I use telnetlib in an app I am writing, and would like to add >functionality to it to support interactive terminal sessions , IE: be >able to 'vi' a file. > >Currently it seems telnetlib isnt quite sophisticated

Re: A Universe Set

2006-10-04 Thread Jean-Paul Calderone
On Wed, 04 Oct 2006 11:00:28 -0400, Leif K-Brooks <[EMAIL PROTECTED]> wrote: >Jorgen Grahn wrote: >> - infinite xrange()s > >itertools.count()? Not quite: >>> import sys, itertools >>> c = itertools.count(sys.maxint) >>> c.next() 2147483647 >>> c.next() -2147483648 >>>

Re: Inotify on netfilter socket

2006-11-17 Thread Jean-Paul Calderone
On Fri, 17 Nov 2006 22:52:51 +, tom <[EMAIL PROTECTED]> wrote: >Hi Guys, > >I'm wondering if it's possible to set up an inotify watch on a netfilter >socket. I want to monitor for incoming packets to the netfilter QUEUE >target, but I can't seem to do it. select.select works on it, but i >want

Re: I/O Multiplexing and non blocking socket

2006-12-01 Thread Jean-Paul Calderone
On 1 Dec 2006 06:07:28 -0800, Salvatore Di Fazio <[EMAIL PROTECTED]> wrote: >Hi guys, >I'm looking for a tutorial to make a client with a i/o multiplexing and >non blocking socket. > >Anybody knows where is a tutorial? http://twistedmatrix.com/projects/core/documentation/howto/clients.html Jean-P

Re: client/server design and advice

2006-12-01 Thread Jean-Paul Calderone
On 1 Dec 2006 06:52:37 -0800, TonyM <[EMAIL PROTECTED]> wrote: >I recently completed the general guidelines for a future project that I >would like to start developing...but I've sort of hit a wall with >respect to how to design it. In short, I want to run through >approximately 5gigs of financial

Re: twisted problem with reactor.stop()

2006-12-03 Thread Jean-Paul Calderone
On 3 Dec 2006 03:16:44 -0800, [EMAIL PROTECTED] wrote: >hello, everyone >I use twisted 1.3 in my python application. >in my program, I have one server and on client running at same time (so >2 reactor.run(installSignalHandlers=0) ) >the client run in one thread and the server in an other thread ( >

Re: Why not just show the out-of-range index?

2006-12-03 Thread Jean-Paul Calderone
On 3 Dec 2006 17:23:49 -0800, Russ <[EMAIL PROTECTED]> wrote: > >> Rather, they (like I) will encourage to OP to submit a patch that fixes the >> problem. > >Now, that would be rather silly. I would have to familiarize myself >with the code for the Python interpreter, then send a patch to the >mai

Re: Monitoring number of smtp bytes sent through python e-mail socket

2006-12-04 Thread Jean-Paul Calderone
On Tue, 05 Dec 2006 12:18:08 +1100, William Connery <[EMAIL PROTECTED]> wrote: >Hi, > >I have a small python program with e-mail capabilities that I have >pieced together from code snippets found on the internet. > >The program uses the smtplib module to successfully send an e-mail with >an attachm

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Jean-Paul Calderone
On 6 Dec 2006 06:34:49 -0800, antred <[EMAIL PROTECTED]> wrote: >I've noticed something odd in Python 2.5, namely that the 2 argument >version of 'assert' is broken. Or at least it seems that way to me. > >Run the following code in your Python interpreter: > >myString = None > >assert( myString, 'T

Re: SSH File Transfer Protocol or SFTP

2006-12-11 Thread Jean-Paul Calderone
On 11 Dec 2006 07:29:27 -0800, Lad <[EMAIL PROTECTED]> wrote: >Is there a module in Python available that I can use for uploading >files via > SFTP (SSH File Transfer Protocol)? >Or do you think that FTP protocol for files uploading is OK? >Thank you for replies >Lad. > Twisted Conch includes su

Re: merits of Lisp vs Python

2006-12-17 Thread Jean-Paul Calderone
On 11 Dec 2006 03:01:32 -0800, Ravi Teja <[EMAIL PROTECTED]> wrote: >Timofei Shatrov wrote: > > [snip] > >Of course, doctest is hardly the ultimate testing solution. But it does >an admirable job for many cases where you don't need to setup elaborate >tests. > >> It's not surprising that no one use

Re: Shed Skin - Does it break any Python assumptions?

2006-12-18 Thread Jean-Paul Calderone
On Mon, 18 Dec 2006 08:07:59 -0600, [EMAIL PROTECTED] wrote: >I just noticed the announcement of Shed Skin 0.0.16 on Freshmeat with this >(partial) change announcement: > >Changes: frozenset was added. time.sleep now works on Win32. > >Given Python's highly dynamic nature it's unclear to me how

Re: Support of IPv6 extension headers

2006-12-20 Thread Jean-Paul Calderone
On 20 Dec 2006 07:07:02 -0800, cychong <[EMAIL PROTECTED]> wrote: >Hi, > >There is no probleming in programming the basic IPv6 socket program >with the python. >Then how about the IPv6 extension header? The RFC 2292 and man pages >from the unix/linux advise >to use the sendmsg to send the packet wi

Re: Why can't you use varargs and keyword arguments together?

2006-12-21 Thread Jean-Paul Calderone
On 21 Dec 2006 14:51:15 -0800, Sandra-24 <[EMAIL PROTECTED]> wrote: >I've always wondered why I can't do: > >def foo(a,b,c): >return a,b,c > >args = range(2) >foo(*args, c = 2) > >When you can do: > >foo(*args, **{'c':2}) You just need to turn things around: >>> def foo(a, b, c): ...

Re: loose methods : Smalltalk asPython

2006-12-27 Thread Jean-Paul Calderone
On Wed, 27 Dec 2006 19:03:12 +1100, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >You can't modify the built-in classes. I'm not sure that it is a good idea >to allow built-ins to be modified. When I see an int, I like the fact that >I know what the int can do, and I don't have to worry about wheth

Re: how can I modify an imported variable ?

2006-12-27 Thread Jean-Paul Calderone
On Wed, 27 Dec 2006 14:50:18 GMT, yomgui <[EMAIL PROTECTED]> wrote: >I've tried this: > >import MyPackage >if MyPackage.aVariable is None: > MyPackage.aVariable = True > >but when I tried to access MyPackage.aVariable from another file >(ie through an other import) the value is still None. > >

Re: newbie question: any better way to write this code?

2006-12-27 Thread Jean-Paul Calderone
On 27 Dec 2006 07:18:22 -0800, neoedmund <[EMAIL PROTECTED]> wrote: >i want to let a byte array to be xor with some value. >but code show below i wrote seems not so .. good..., any better way to >write such function? thanks. >[code] >def xor(buf): > bout=[] > for i in range(len(buf)): >

RE: Looking for python SIP/MGCP stacks

2007-01-02 Thread Jean-Paul Calderone
On Tue, 2 Jan 2007 09:02:17 -0800, "Jenny Zhao \(zhzhao\)" <[EMAIL PROTECTED]> wrote: >Thanks Anthony. > >I am wondering where I can get Divmod Sine and Shtoom. Are they open >source ? > http://divmod.org/trac/wiki/DivmodSine http://divmod.org/trac/wiki/ShtoomProject Shtoom is LGPL. Sine borro

Re: search mail by date with imaplib

2007-01-06 Thread Jean-Paul Calderone
On Sat, 06 Jan 2007 11:49:17 -0800, rweth <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: >> Hi >> I am looking for a code sample which searches mail by date with imaplib >> >> example: >> get email from 01.01.2007 to now >> >> how can I change imaplib search parameters? >> >So I had to do the

Re: Some thougts on cartesian products

2006-01-22 Thread Jean-Paul Calderone
On Mon, 23 Jan 2006 03:21:59 +0100, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > >BTW: What is the shortest way to get the binary representation of a >number in Python? Is there really not something like itoa() anywhere in >the standard libs? I'm somewhat partial to this implementation: bina

Re: Backreferences in python ?

2006-01-23 Thread Jean-Paul Calderone
On 23 Jan 2006 07:18:13 -0800, Pankaj <[EMAIL PROTECTED]> wrote: > > [snip] >What i tried in python was:: > >f = open( "./1.c", "r") >fNew = open( "./1_new.c", "w") >for l in f: >print l >lineno = lineno + 1 >strToFind = "for\((.*)\;(.*)" > >## For Converting int to

Re: Tkinter listener thread?

2006-01-26 Thread Jean-Paul Calderone
On 26 Jan 2006 08:46:11 -0800, gregarican <[EMAIL PROTECTED]> wrote: >I have a Python UDP listener socket that waits for incoming data. The >socket runs as an endless loop. I would like to pop the incoming data >into an existing Tkinter app that I have created. What's the >easiest/most efficient wa

Re: Starting terminal applications from within python

2006-02-02 Thread Jean-Paul Calderone
On 2 Feb 2006 09:01:11 -0800, sleepylight <[EMAIL PROTECTED]> wrote: >Hi > >I'm staring to learn python for some systems administration projects >and so far this looks like a really great alternative to using shell >for everything. The python docs on the web site are really great, but >I could use

Re: my openGL API need threads!!! But how to ,ake it work???

2006-02-02 Thread Jean-Paul Calderone
On 2 Feb 2006 09:29:45 -0800, Laurent <[EMAIL PROTECTED]> wrote: >That is exactly what I do not want!! > >this is not transparent, I'm sure it is possible to make what I want: >Scene = ooglScene() >Scene.run() >scene.append(ooglPoint()) Most concurrency is never even remotely transparent. Stop ch

Re: classmethod and instance method

2006-02-02 Thread Jean-Paul Calderone
On 2 Feb 2006 12:08:43 -0800, [EMAIL PROTECTED] wrote: >Hi, > >I'm trying to write a method that needs to know both the class name and >the instance details > >class A: > >@classmethod >def meth(cls, self): >print cls >print self > >a = A() >a.meth(a) > >The above code seem

Re: Another try at Python's selfishness

2006-02-03 Thread Jean-Paul Calderone
On 3 Feb 2006 08:58:56 -0800, [EMAIL PROTECTED] wrote: >> ... >> Unfortunately, none of this suggests that it's reasonable to have >> >> def x.y(z): ... >> >> mean the same as >> >> def y(x, z): ... > >Actually, it shouldn't. The idea was, that >def x.y(z): ... >(explicitly) introduces an unbou

Re: Another try at Python's selfishness

2006-02-03 Thread Jean-Paul Calderone
On Fri, 3 Feb 2006 15:27:51 -0500, Terry Reedy <[EMAIL PROTECTED]> wrote: > >"Magnus Lycka" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> [EMAIL PROTECTED] wrote: >> Today, Python has a syntactic shortcut. If 'a' is an >> instance of class 'A', a.f(x,y,z) is a shortcut for >> A.f(

Re: Replacing curses (Was: Re: Problem with curses and UTF-8)

2006-02-08 Thread Jean-Paul Calderone
On Wed, 08 Feb 2006 15:10:26 -0500, Ian Ward <[EMAIL PROTECTED]> wrote: >Grant Edwards wrote: >> Depending on what you're tring to do, slang might be an option, > >I've looked at newt and snack, but all I really need is: >- a way to position the cursor at (0,0) >- a way to hide and show the cursor

Re: Tracking down memory leaks?

2006-02-12 Thread Jean-Paul Calderone
On 12 Feb 2006 10:13:02 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >>> I'm not an expert on python internals, and it is possible that they have >>> a way of checking for cases like this. I think the deepcopy method >>> catches this, but I don't *think* basic garbage collection look for

Re: is socket thread safe?

2006-02-15 Thread Jean-Paul Calderone
On Wed, 15 Feb 2006 12:59:03 -0800, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: >Steve Horsley wrote: >> [EMAIL PROTECTED] wrote: >> >>> thread1: >>> while 1: >>> buf = s.read() >>> process(buf) >>> >>> thread2: >>> while 1: >>> buf = getdata() >>> s.wr

Re: any ftpd written in python?

2006-02-16 Thread Jean-Paul Calderone
On Thu, 16 Feb 2006 14:07:55 +0800, Kenneth Xie <[EMAIL PROTECTED]> wrote: >I need a simple ftpd example in pure python. Is there already such a >ftpd available? >Thank you very much in advance. Twisted includes an FTP server: [EMAIL PROTECTED]:~$ mkdir a a/b a/c a/d [EMAIL PROTECTED]:~$ mkta

Re: Safe Python Execution

2006-02-17 Thread Jean-Paul Calderone
On Thu, 16 Feb 2006 07:59:03 -0800, Alex Martelli <[EMAIL PROTECTED]> wrote: >Graham <[EMAIL PROTECTED]> wrote: > >> I've been messing around with trying to get a small sandbox like >> environment where i could execute python code in a "safe" way. >> Basically what the old restricted execution modu

Re: question about scope

2006-02-17 Thread Jean-Paul Calderone
On Thu, 16 Feb 2006 15:18:29 GMT, John Salerno <[EMAIL PROTECTED]> wrote: > [snip] > >I understand what global and built-in are, and I thought I understood >the concept of local too, but when I got to this sentence (and the >previous sentence), I became confused about the first two scopes. What's >

Re: commenting out blocks of code

2006-02-17 Thread Jean-Paul Calderone
On Sat, 18 Feb 2006 12:36:06 +1100, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > [snip] > >Commenting and uncommenting should be two different commands: the whole >point of nested comments is that it allows you to comment a block of text >which may already contain comments. Having one command do bo

Re: Multi-threaded SSL

2006-02-18 Thread Jean-Paul Calderone
On 17 Feb 2006 23:37:22 -0800, [EMAIL PROTECTED] wrote: >Thanks Alex. I hadn't noticed that example. I gave it a shot and >still have the synchronization problems. While this may be because of >a lack of understanding of twisted threads (again, perhaps I'm just not >looking in the right places,

Re: Multiplication optimization

2006-02-18 Thread Jean-Paul Calderone
On 18 Feb 2006 16:48:38 -0800, Paul McGuire <[EMAIL PROTECTED]> wrote: >Does Python's run-time do any optimization of multiplication >operations, like it does for boolean short-cutting? Here's the beginning of int_mul from Objects/intobject.c: static PyObject * int_mul(PyObject *v, PyObje

RE: Which is faster? (if not b in m) or (if m.count(b) > 0)

2006-02-19 Thread Jean-Paul Calderone
On Mon, 20 Feb 2006 10:08:48 +1100, "Delaney, Timothy \(Tim\)" <[EMAIL PROTECTED]> wrote: >Farel wrote: > >> Tim, Are you saying that: >> not (b in m) >> is faster than: >> b not in m > >On the contrary. `not (b in m)` requires negating the result of `b in m` >(via an additional bytecode

Re: wanted: ftp server class

2006-03-06 Thread Jean-Paul Calderone
On Mon, 06 Mar 2006 16:37:21 GMT, John Pote <[EMAIL PROTECTED]> wrote: >Hi everyone, > >I have a 'client' with a built in ftp client that I wish to use to access a >server via the internet. But I do not want to use a standard disk accessing >ftp server as I need to do my own processing between the

Re: Standalone HTTP parser?

2007-05-31 Thread Jean-Paul Calderone
On Thu, 31 May 2007 14:07:00 -0400, Christopher Stawarz <[EMAIL PROTECTED]> wrote: >Does anyone know of a standalone module for parsing and generating >HTTP messages? I'm looking for something that will take a string and >return a convenient message object, and vice versa. All the Python >HTTP p

Re: How to use TLS lite

2007-06-08 Thread Jean-Paul Calderone
On Sat, 9 Jun 2007 05:58:41 +1000 (EST), Mr SZ <[EMAIL PROTECTED]> wrote: >I'm using tls lite to send mail using gmail's smtp.This is what I've done: > >from tlslite.api import * >import tlslite.integration.SMTP_TLS >connection= tlslite.integration.SMTP_TLS.SMTP_TLS('smtp.gmail.com',587) >connecti

Re: Could someone show me a sample how to flush the socket sending buffer? Thanks a lot.

2007-06-08 Thread Jean-Paul Calderone
On Fri, 08 Jun 2007 15:36:30 -0700, mike <[EMAIL PROTECTED]> wrote: >I have called the setsockopt() to set no delay after connecting like >this way: > >s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >s.connect(('192.168.10.1', 21980)) >s.setsockopt(socket.SOL_TCP, soc

RE: Hooking exceptions outside of call stack

2007-06-09 Thread Jean-Paul Calderone
On Sat, 9 Jun 2007 13:52:19 -0700, Warren Stringer <[EMAIL PROTECTED]> wrote: >Am still trying to hook a NameError exception and continue to run. After a >few more hours of searching the web and pouring over Martelli's book, the >closest I've come is: > import sys def new_exit(arg=0): >..

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread Jean-Paul Calderone
On Mon, 11 Jun 2007 04:56:43 -0700, geoffbache <[EMAIL PROTECTED]> wrote: > >> Twisted *should* be able to do this, as it uses non-blocking IO. >> >> http://twistedmatrix.com/trac/ > >Thanks for the tip. I'll take a look if nobody has any better >suggestions. Twisted is a pretty good suggestion in

Re: A gotcha: Python pain point?

2007-06-11 Thread Jean-Paul Calderone
On Mon, 11 Jun 2007 16:54:10 -0700, James Stroud <[EMAIL PROTECTED]> wrote: >Beorn wrote: >> Consider this example: >> >> >>> def funcs(x): >> ... for i in range(5): >> ... def g(): return x + i >> ... yield g >> > [snip] > >If this isn't classified as a bug, then someon

Re: Embedding unit tests in source files?

2007-06-17 Thread Jean-Paul Calderone
On Sun, 17 Jun 2007 08:15:46 -0700, Roy Smith <[EMAIL PROTECTED]> wrote: >I'm starting a new project and am thinking of embedding my unit tests >right in the source files. I've used unittest before, and I'm happy >with it, but I've always used it with the source code in one file and >the unit test

Re: Conceptualizing Threading

2007-06-21 Thread Jean-Paul Calderone
On Thu, 21 Jun 2007 06:51:17 -0700, JonathanB <[EMAIL PROTECTED]> wrote: >I have a multi-access problem that I'm pretty sure needs to be solved >with threading, but I'm not sure how to do it. This will be my first >foray into threading, so I'm a little confused by all of the new >landscape. So, I'm

<    1   2   3   4   5   6   7   >