Re: wtf

2007-04-26 Thread Jean-Paul Calderone
On Thu, 26 Apr 2007 21:35:03 +0300, Sergiy [EMAIL PROTECTED] wrote: print 1 / 2 print -1 / 2 0 -1 correct? Quoting http://www.python.org/doc/lib/typesnumeric.html: (1) For (plain or long) integer division, the result is an integer. The result is always rounded towards minus infinity: 1/2

Re: bitwise shift?

2007-04-25 Thread Jean-Paul Calderone
On Wed, 25 Apr 2007 22:54:12 +0200, desktop [EMAIL PROTECTED] wrote: I have found a code example with this loop. for k in range(10, 25): n = 1 k; I have never read Python before but is it correct that 1 get multiplied with the numbers 10,11,12,12,...,25 assuming that 1 k means 1 shift

Re: Select weirdness

2007-04-23 Thread Jean-Paul Calderone
On Mon, 23 Apr 2007 00:33:22 -0700, Ron Garret [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Irmen de Jong [EMAIL PROTECTED] wrote: Ron Garret wrote: I don't understand why socketserver calling select should matter. (And BTW, there are no calls to select in SocketServer.py. I'm

Re: Select weirdness

2007-04-22 Thread Jean-Paul Calderone
On Sun, 22 Apr 2007 11:42:10 -0700, Ron Garret [EMAIL PROTECTED] wrote: I think I've figured out what's going on. [snip] As you can see, the select call shows input available for a while (five lines) and then shows no input available despite the fact that there is manifestly still input

Re: Queue enhancement suggestion

2007-04-17 Thread Jean-Paul Calderone
On 17 Apr 2007 14:32:01 GMT, Antoon Pardon [EMAIL PROTECTED] wrote: On 2007-04-17, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On 17 Apr 2007 13:32:52 GMT, Antoon Pardon [EMAIL PROTECTED] wrote: On 2007-04-17, Hendrik van Rooyen [EMAIL PROTECTED] wrote: [snip] Not sure I understand

Re: Using X509 (and TLSlite) authentication

2007-04-17 Thread Jean-Paul Calderone
On Tue, 17 Apr 2007 13:44:05 GMT, Chaz Ginger [EMAIL PROTECTED] wrote: I have been looking for a server application as an example of how to use TLSLite or PyOpenSSL X509 certificates for authentication. Does any one have a pointer or two? You might want to take a look at the code in Twisted for

Re: Queue enhancement suggestion

2007-04-17 Thread Jean-Paul Calderone
On 17 Apr 2007 13:32:52 GMT, Antoon Pardon [EMAIL PROTECTED] wrote: On 2007-04-17, Hendrik van Rooyen [EMAIL PROTECTED] wrote: [snip] Not sure I understand this - it sounds vaguely incestous to me. I normally use a GUI with two queues, one for input, one for output, to two threads that

Re: unittest assertRaises Problem

2007-04-16 Thread Jean-Paul Calderone
On 16 Apr 2007 15:13:42 -0700, john [EMAIL PROTECTED] wrote: All: Hi. I am an experienced developer (15 yrs), but new to Python and have a question re unittest and assertRaises. No matter what I raise, assertRaises is never successful. Here is the test code: class Foo: def

Re: Queue enhancement suggestion

2007-04-16 Thread Jean-Paul Calderone
On 15 Apr 2007 23:12:34 -0700, Paul Rubin http://phr.cx@nospam.invalid wrote: I'd like to suggest adding a new operation Queue.finish() This puts a special sentinel object on the queue. The sentinel travels through the queue like any other object, however, when q.get() encounters the

Re: Why is __getslice__ still implemented?

2007-04-10 Thread Jean-Paul Calderone
On Tue, 10 Apr 2007 08:35:56 -0600, Steven Bethard [EMAIL PROTECTED] wrote: Torsten Bronger wrote: Hallöchen! According to http://docs.python.org/ref/sequence-methods.html, __getslice__ is deprecated. At the moment, I derive an own class from unicode and want to implement my own slicing. I

Re: installing pyqt4 on ubuntu 6.06

2007-04-10 Thread Jean-Paul Calderone
On Tue, 10 Apr 2007 21:05:37 +0530, Pradnyesh Sawant [EMAIL PROTECTED] wrote: Hello, I have a newly installed ubuntu 6.06 system. I am trying to install pyqt4 on it, but without success. The contents of the /etc/apt/sources.list file are:

Re: Why is __getslice__ still implemented?

2007-04-10 Thread Jean-Paul Calderone
On Tue, 10 Apr 2007 09:51:45 -0600, Steven Bethard [EMAIL PROTECTED] wrote: Jean-Paul Calderone wrote: On Tue, 10 Apr 2007 08:35:56 -0600, Steven Bethard [EMAIL PROTECTED] wrote: Yes, you do still need to implement __getslice__ if you're subclassing a class (like unicode or list) which

Re: socket read timeout

2007-03-30 Thread Jean-Paul Calderone
On Fri, 30 Mar 2007 08:22:18 +0200, Hendrik van Rooyen [EMAIL PROTECTED] wrote: Jean-Paul Calderone [EMAIL PROTECTED] wrote: On Thu, 29 Mar 2007 07:29:35 +0200, Hendrik van Rooyen [EMAIL PROTECTED] wrote: Are sockets full duplex? Uh, yes. The reason I asked is that I have noticed

Re: newbi question on python rpc server, how it works?

2007-03-29 Thread Jean-Paul Calderone
On Thu, 29 Mar 2007 11:25:38 +0530, krishnakant Mane [EMAIL PROTECTED] wrote: hello all, I have downloaded the entire twisted library. I am also trying to read the documentation but I have a couple of problems right now. firstly, I did not find any thing in twisted documentation that

Re: socket read timeout

2007-03-29 Thread Jean-Paul Calderone
On Thu, 29 Mar 2007 07:29:35 +0200, Hendrik van Rooyen [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: hg My issue with that is the effect on write: I only want a timeout on hg read ... but anyway ... So set a long timeout when you want to write and short timeout when you want

Re: with timeout(...):

2007-03-29 Thread Jean-Paul Calderone
On Thu, 29 Mar 2007 11:30:04 -0500, Nick Craig-Wood [EMAIL PROTECTED] wrote: Diez B. Roggisch [EMAIL PROTECTED] wrote: I beleive the convention is when calling an OS function which might block the global interpreter lock is dropped, thus allowing other python bytecode to run. So what?

Re: Fortran vs Python - Newbie Question

2007-03-26 Thread Jean-Paul Calderone
On 26 Mar 2007 06:20:32 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: OK... I've been told that Both Fortran and Python are easy to read, and are Python is hugely easier to read. quite useful in creating scientific apps for the number crunching, but then Python is a tad slower than Fortran

Re: Fortran vs Python - Newbie Question

2007-03-26 Thread Jean-Paul Calderone
On 26 Mar 2007 06:47:18 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Mar 26, 2:42 pm, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On 26 Mar 2007 06:20:32 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: OK... I've been told that Both Fortran and Python are easy to read

Re: Sending ECHO_REQUEST (pinging) with python

2007-03-26 Thread Jean-Paul Calderone
On Mon, 26 Mar 2007 16:50:33 +0200, Thomas Dybdahl Ahle [EMAIL PROTECTED] wrote: Den Mon, 26 Mar 2007 06:30:04 -0500 skrev Nick Craig-Wood: Michael Bentley [EMAIL PROTECTED] wrote: On Mar 26, 2007, at 1:30 AM, Thomas Dybdahl Ahle wrote: It seems however that I have to be root to send those

Re: Python object overhead?

2007-03-26 Thread Jean-Paul Calderone
On Mon, 26 Mar 2007 09:13:58 -0600, Matt Garman [EMAIL PROTECTED] wrote: On 3/23/07, Jack Diederich [EMAIL PROTECTED] wrote: If you make the record a new style class (inherit from object) you can specify the __slots__ attribute on the class. This eliminates the per instance dictionary overhead

Re: Strange behavior when printing a returned closure function

2007-03-25 Thread Jean-Paul Calderone
On 25 Mar 2007 03:59:52 -0700, [EMAIL PROTECTED] wrote: Hello, when I execute the following code (python 2.5) def f(x): def g(): return x return g print f(1) print f(2) I get an output like function g at 0x00AFC1F0 function g at 0x00AFC1F0 So according to print I get the

Re: Python object overhead?

2007-03-24 Thread Jean-Paul Calderone
On 24 Mar 2007 13:08:02 -0700, 7stud [EMAIL PROTECTED] wrote: On Mar 23, 4:04 pm, Jack Diederich [EMAIL PROTECTED] wrote: If you make the record a new style class (inherit from object) you can specify the __slots__ attribute on the class. This eliminates the per instance dictionary overhead

Re: Python object overhead?

2007-03-24 Thread Jean-Paul Calderone
On 24 Mar 2007 13:52:46 -0700, 7stud [EMAIL PROTECTED] wrote: On Mar 24, 2:19 pm, Jean-Paul Calderone [EMAIL PROTECTED] wrote: Only one list is created. It is used to define a C array where attributes will be stored. Each instance still has that C array, but it has much less overhead than

Re: Still the __new__ hell ...

2007-03-19 Thread Jean-Paul Calderone
On Mon, 19 Mar 2007 13:17:11 +0100, Bruno Desthuilliers [snip] And what if it's a unicode string ? The correct idiom here is: if isinstance(year, basestring): year,month,day=map(int,string.split(year,'-')) year, month, day =

Re: Still the __new__ hell ...

2007-03-19 Thread Jean-Paul Calderone
On Mon, 19 Mar 2007 15:39:49 +0100, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Jean-Paul Calderone a écrit : On Mon, 19 Mar 2007 13:17:11 +0100, Bruno Desthuilliers [snip] And what if it's a unicode string ? The correct idiom here is: if isinstance(year, basestring

Re: Database module multithreading

2007-03-10 Thread Jean-Paul Calderone
On 10 Mar 2007 07:40:23 -0800, jupiter [EMAIL PROTECTED] wrote: On Mar 10, 8:16 pm, Michael Bentley [EMAIL PROTECTED] wrote: Thanx for this pointer buddy! I have done my homework. Some Database modules are not actively maintained some modules does not work with Python 2.5. At this moment I

Re: Webserver balance load

2007-03-05 Thread Jean-Paul Calderone
On 5 Mar 2007 11:47:15 -0800, Johny [EMAIL PROTECTED] wrote: Can anyone suggest a way how to balance load on Apache server where I have Python scripts running? For example I have 3 webservers( Apache servers) and I would like to sent user's request to one of the three server depending on a load on

Re: implementing SFTP using Python

2007-03-02 Thread Jean-Paul Calderone
On Fri, 2 Mar 2007 20:42:55 -0800 (PST), kadarla kiran kumar [EMAIL PROTECTED] wrote: Hi Everybody, I have to implement SFTP conection from client to the server using Python script. Iam very new new to python , and i dont't have much time to complete this. So I need some pointers from

Re: How to update DNS record

2007-03-01 Thread Jean-Paul Calderone
On 1 Mar 2007 04:14:23 -0800, [EMAIL PROTECTED] wrote: On Mar 1, 10:33 am, Bjoern Schliessmann usenet- [EMAIL PROTECTED] wrote: Read RFC 2136 (Dynamic updates in the DNS) and see if your server can be configured to do this. If not, you'll have to change the zone files manually and reload the

Re: GIS Shape file upload to FTP server

2007-03-01 Thread Jean-Paul Calderone
On Thu, 1 Mar 2007 14:58:11 -0500, Ahmed, Shakir [EMAIL PROTECTED] wrote: HI Group, As I am very new in python field so this question might be very silly to you but if I get any help is highly appreciated. Problem: I wrote a python script which is working fine to upload files to the ftp server

Re: getting terminal display size?

2007-02-25 Thread Jean-Paul Calderone
On 25 Feb 2007 16:53:17 -0800, jeff [EMAIL PROTECTED] wrote: I looked around a lot on the internet and couldn't find out how to do this, how do I get the sizer (in rows and columns) of the view? Assuming you're talking about something vaguely *NIXy, you want something like what's being done

Re: Creating a daemon process in Python

2007-02-23 Thread Jean-Paul Calderone
On Fri, 23 Feb 2007 08:30:07 -0600, Nick Craig-Wood [EMAIL PROTECTED] wrote: Eirikur Hallgrimsson [EMAIL PROTECTED] wrote: [snip] if (not os.fork()): # hang around till adopted by init ppid = os.getppid() while (ppid != 1):

Re: plugin development best practices

2007-02-22 Thread Jean-Paul Calderone
On 22 Feb 2007 04:53:02 -0800, Flavio [EMAIL PROTECTED] wrote: Hi, Nowadays the addition of functionality to programs by means of plugins is very frequent. I want to know the opinions of experienced Python developers about the best practices when it comes to developing a plugin system for a

Re: plugin development best practices

2007-02-22 Thread Jean-Paul Calderone
On Thu, 22 Feb 2007 15:36:42 +0100, Diez B. Roggisch [EMAIL PROTECTED] wrote: Simple plugin system proposal: have a package (directory with __init__.py) called plugins where the actual plugins are modules in this directory. When the main script imports the plugins package, all plugin

Re: converting u'11\xa022' to '11\xa022'

2007-02-20 Thread Jean-Paul Calderone
On Tue, 20 Feb 2007 18:12:42 -0600, alf [EMAIL PROTECTED] wrote: Hi, is there a more elegant way to do that: ''.join([chr(ord(i)) for i in u'11\xa022' ]) u'11\xa022'.encode('charmap') Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Declare a variable global

2007-02-19 Thread Jean-Paul Calderone
On 19 Feb 2007 09:04:19 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I have the following code: colorIndex = 0; def test(): print colorIndex; This won't work. Are you sure? [EMAIL PROTECTED]:~$ cat foo.py colorIndex = 0 def test(): print colorIndex

Re: Pep 3105: the end of print?

2007-02-16 Thread Jean-Paul Calderone
On Sat, 17 Feb 2007 01:32:21 +1100, Steven D'Aprano [snip] I don't think that follows at all. print is only a problem if you expect your code to work under both Python 2.x and 3.x. I wouldn't imagine that many people are going to expect that: I know I don't. I think some people are confused

Re: Pep 3105: the end of print?

2007-02-16 Thread Jean-Paul Calderone
On Sat, 17 Feb 2007 02:17:23 +1100, Steven D'Aprano [EMAIL PROTECTED] wrote: On Fri, 16 Feb 2007 09:49:03 -0500, Jean-Paul Calderone wrote: On Sat, 17 Feb 2007 01:32:21 +1100, Steven D'Aprano [snip] I don't think that follows at all. print is only a problem if you expect your code to work

Re: Pep 3105: the end of print?

2007-02-16 Thread Jean-Paul Calderone
On Fri, 16 Feb 2007 16:49:05 +0100, BJörn Lindqvist [EMAIL PROTECTED] wrote: On 2/16/07, Jean-Paul Calderone [EMAIL PROTECTED] wrote: I was just pointing out that some people might be confused. I didn't make any judgement about that fact. You seem to be suggesting that because there are other

Re: AUX File Writing Error

2007-02-15 Thread Jean-Paul Calderone
On Thu, 15 Feb 2007 10:13:17 -0300, Gabriel Genellina [EMAIL PROTECTED] wrote: En Thu, 15 Feb 2007 03:34:59 -0300, John Machin [EMAIL PROTECTED] escribió: On Feb 15, 4:03 pm, [EMAIL PROTECTED] wrote: Is there any way I can create an AUX.csv file without the error? Probably not. AUX, CON, NUL,

Re: How to print the variable?

2007-02-14 Thread Jean-Paul Calderone
On Wed, 14 Feb 2007 05:47:31 -0800 (PST), Hans Schwaebli [EMAIL PROTECTED] wrote: Hi, am am a Python beginner with Java knowledge background. Infact I need to use Jython. My first beginner question is how to determine of what type a variable is? In program which supports Jython there

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread Jean-Paul Calderone
On 14 Feb 2007 11:41:29 -0800, redawgts [EMAIL PROTECTED] wrote: I keep getting this error local variable 'f' referenced before assignment in the finally block when I run the following code. try: f = file(self.filename, 'rb') f.seek(DATA_OFFSET)

Re: Help with Optimization of Python software: real-time audio controller

2007-02-12 Thread Jean-Paul Calderone
On 12 Feb 2007 06:21:39 -0800, Ross Ridge [EMAIL PROTECTED] wrote: Paul Rubin wrote: I think you can't really do that, not just because of Python but also as a result of using a multitasking OS that's not especially designed for real time. You have to rely on some buffering in the audio

Re: help on packet format for tcp/ip programming

2007-02-08 Thread Jean-Paul Calderone
On Thu, 08 Feb 2007 15:56:30 +0100, Diez B. Roggisch [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 8, 3:40 am, Grant Edwards [EMAIL PROTECTED] wrote: On 2007-02-08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: struct module pack and unpack will only work for fixed size buffer :

Re: postgres backup script and popen2

2007-02-08 Thread Jean-Paul Calderone
On 8 Feb 2007 08:23:49 -0800, Gabriel Genellina [EMAIL PROTECTED] wrote: On 8 feb, 10:27, Maël Benjamin Mettler [EMAIL PROTECTED] wrote: flupke schrieb: i made a backup script to backup my postgres database. Problem is that it prompts for a password. It thought i could solve this by using

Re: postgres backup script and popen2

2007-02-08 Thread Jean-Paul Calderone
On 8 Feb 2007 09:18:26 -0800, Gabriel Genellina [EMAIL PROTECTED] wrote: On 8 feb, 13:29, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On 8 Feb 2007 08:23:49 -0800, Gabriel Genellina [EMAIL PROTECTED] wrote: On 8 feb, 10:27, Maël Benjamin Mettler [EMAIL PROTECTED] wrote: flupke schrieb: i

Re: when will python 2.5 take in mainstream?

2007-02-06 Thread Jean-Paul Calderone
On 6 Feb 2007 04:45:35 -0800, Ben Sizer [EMAIL PROTECTED] wrote: On Feb 5, 4:15 pm, Jean-Paul Calderone [EMAIL PROTECTED] wrote: It's very easy to maintain compatibility in the C API. I'm much more interested in compatibility at the Python layer, which is changed incompatibly much, much more

Re: huge amounts of pure Python code broken by Python 2.5?

2007-02-06 Thread Jean-Paul Calderone
On Tue, 06 Feb 2007 08:40:40 -0700, Steven Bethard [EMAIL PROTECTED] wrote: Jean-Paul Calderone [EMAIL PROTECTED] wrote: Huge amounts of my pure Python code was broken by Python 2.5. Interesting. Could you give a few illustrations of this? (I didn't run into the same problem at all, so I'm

Re: Python editor

2007-02-06 Thread Jean-Paul Calderone
On 6 Feb 2007 12:51:13 -0800, BBands [EMAIL PROTECTED] wrote: No, no, no, this is not an invitation to the editor wars. I have been using José Cláudio Faria's superb Tinn-R, http://www.sciviews.org/Tinn-R/, with the R language, http://www.r-project.org/. This editor allows you to send code to

Re: subprocess stdin encoding

2007-02-05 Thread Jean-Paul Calderone
On Mon, 05 Feb 2007 20:54:48 +0800, Thinker [EMAIL PROTECTED] wrote: [snip] in site.py . and change if 0: to if 1: to enable string encoding. Now, you can execute python interpreter with LC_CTYPE='UTF-8'. While this is sort of a correct answer to the question asked, it isn't really a correct

Re: subprocess stdin encoding

2007-02-05 Thread Jean-Paul Calderone
On 4 Feb 2007 23:10:29 -0800, yc [EMAIL PROTECTED] wrote: I have a encoding problem during using of subprocess. The input is a string with UTF-8 encoding. the code is: tokenize = subprocess.Popen(tok_command,stdin=subprocess.PIPE,stdout=subprocess.PIPE,close_fds=True,shell=True)

Re: when will python 2.5 take in mainstream?

2007-02-05 Thread Jean-Paul Calderone
On Mon, 05 Feb 2007 10:19:26 +0100, Laurent Pointal [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] a écrit : When they have to ... One of the big things about Python is that its penetration slows it down. There's more legacy code and interdependant systems around now that Python is more

Re: Python 3.0 (Was: when will python 2.5 take in mainstream?)

2007-02-05 Thread Jean-Paul Calderone
On Mon, 05 Feb 2007 07:01:26 -0700, Steven Bethard [EMAIL PROTECTED] wrote: Laurent Pointal wrote: For Python 3.0, AFAIK its a big rewrite and developers know that it will be uncompatible in large parts with existing code. Wrong on both counts. ;-) Python 3.0 is not a rewrite. It's based on the

Re: when will python 2.5 take in mainstream?

2007-02-05 Thread Jean-Paul Calderone
On Mon, 05 Feb 2007 17:07:15 +0100, Laurent Pointal [EMAIL PROTECTED] wrote: Jean-Paul Calderone a écrit : On Mon, 05 Feb 2007 10:19:26 +0100, Laurent Pointal [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] a écrit : When they have to ... One of the big things about Python is that its penetration

Re: asyncore DoS vulnerability

2007-02-02 Thread Jean-Paul Calderone
On Fri, 2 Feb 2007 10:39:57 -0600, [EMAIL PROTECTED] wrote: billie asyncore aims to be a framework, right? I think that when billie select() limit is reached asyncore should just drop other billie connections. That's all. You're asking asyncore to make a policy decision on behalf

Re: Any python scripts to do parallel downloading?

2007-02-01 Thread Jean-Paul Calderone
On 31 Jan 2007 22:02:36 -0800, Michele Simionato [EMAIL PROTECTED] wrote: On Jan 31, 8:31 pm, Carl J. Van Arsdall [EMAIL PROTECTED] wrote: Well, since it will be io based, why not use threads? They are easy to use and it would do the job just fine. Then leverage some other technology on top

Re: Any python scripts to do parallel downloading?

2007-02-01 Thread Jean-Paul Calderone
On 1 Feb 2007 06:14:40 -0800, Carl Banks [EMAIL PROTECTED] wrote: On Jan 31, 3:37 pm, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On 31 Jan 2007 12:24:21 -0800, Carl Banks [EMAIL PROTECTED] wrote: Michele Simionato wrote: On Jan 31, 5:23 pm, Frank Potter [EMAIL PROTECTED] wrote: I want

Re: Any python scripts to do parallel downloading?

2007-02-01 Thread Jean-Paul Calderone
On 1 Feb 2007 06:41:56 -0800, Carl Banks [EMAIL PROTECTED] wrote: On Feb 1, 9:20 am, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On 1 Feb 2007 06:14:40 -0800, Carl Banks [EMAIL PROTECTED] wrote: On Jan 31, 3:37 pm, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On 31 Jan 2007 12:24:21 -0800

Re: Any python scripts to do parallel downloading?

2007-01-31 Thread Jean-Paul Calderone
On 31 Jan 2007 08:23:57 -0800, Frank Potter [EMAIL PROTECTED] wrote: I want to find a multithreaded downloading lib in python, can someone recommend one for me, please? Thanks~ There are no threads, but perhaps http://jcalderone.livejournal.com/24285.html would be interesting to you. Jean-Paul

Re: What is the dummy statement that do nothing in Python?

2007-01-31 Thread Jean-Paul Calderone
On Wed, 31 Jan 2007 11:49:53 -0500, Dongsheng Ruan [EMAIL PROTECTED] wrote: I remember that in python there is some kind of dummy statement that just holds space and does nothing. I want it to hold the place after a something like if ab: do nothing I can't just leave the space blank after if

Re: Any python scripts to do parallel downloading?

2007-01-31 Thread Jean-Paul Calderone
On 31 Jan 2007 12:24:21 -0800, Carl Banks [EMAIL PROTECTED] wrote: Michele Simionato wrote: On Jan 31, 5:23 pm, Frank Potter [EMAIL PROTECTED] wrote: I want to find a multithreaded downloading lib in python, can someone recommend one for me, please? Thanks~ Why do you want to use threads

Re: Any python scripts to do parallel downloading?

2007-01-31 Thread Jean-Paul Calderone
On Wed, 31 Jan 2007 13:52:35 -0800, Carl J. Van Arsdall [EMAIL PROTECTED] wrote: Jean-Paul Calderone wrote: On 31 Jan 2007 12:24:21 -0800, Carl Banks [EMAIL PROTECTED] wrote: Michele Simionato wrote: On Jan 31, 5:23 pm, Frank Potter [EMAIL PROTECTED] wrote: I want to find a multithreaded

Re: Any python scripts to do parallel downloading?

2007-01-31 Thread Jean-Paul Calderone
On Wed, 31 Jan 2007 15:13:59 -0800, Carl J. Van Arsdall [EMAIL PROTECTED] wrote: Jean-Paul Calderone wrote: [snip] You're right. Learning new things is bad. My mistake. Jean-Paul That isn't what I said at all. You have to look at it from a cost/benefit relationship. Its a waste

Re: Any python scripts to do parallel downloading?

2007-01-31 Thread Jean-Paul Calderone
On Wed, 31 Jan 2007 17:19:07 -0800, Carl J. Van Arsdall [EMAIL PROTECTED] wrote: Jean-Paul Calderone wrote: On Wed, 31 Jan 2007 15:13:59 -0800, Carl J. Van Arsdall [EMAIL PROTECTED] wrote: Jean-Paul Calderone wrote: [snip] You're right. Learning new things is bad. My mistake. Jean

Re: Any python scripts to do parallel downloading?

2007-01-31 Thread Jean-Paul Calderone
On 31 Jan 2007 19:12:59 -0800, Aahz [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Jean-Paul Calderone [EMAIL PROTECTED] wrote: You misunderstand. I wasn't expressing a lack of confidence in Python threads, but in the facility with which they can be used by programmers. Based on my

Re: Synchronous shutil.copyfile()

2007-01-30 Thread Jean-Paul Calderone
On Tue, 30 Jan 2007 15:05:23 +, Hugo Ferreira [EMAIL PROTECTED] wrote: Hi there, I have a problem. I'm using calling shutil.copyfile() followed by open(). The thing is that most of the times open() is called before the actual file is copied. I don't have this problem when doing a step-by-step

Re: Help me understand this

2007-01-30 Thread Jean-Paul Calderone
On Tue, 30 Jan 2007 14:39:28 -0300, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 30 Jan 2007 06:34:01 -0300, Beej [EMAIL PROTECTED] escribió: But here's one I still don't get: type(2) type 'int' type((2)) type 'int' (2).__add__(1) 3 2.__add__(1) File stdin, line 1

Re: Executing Javascript, then reading value

2007-01-29 Thread Jean-Paul Calderone
On 29 Jan 2007 12:44:07 -0800, Melih Onvural [EMAIL PROTECTED] wrote: I need to execute some javascript and then read the value as part of a program that I am writing. I am currently doing something like this: Python doesn't include a JavaScript runtime. You might look into the stand-alone

Re: Trouble with max() and __cmp__()

2007-01-28 Thread Jean-Paul Calderone
On 28 Jan 2007 12:46:07 -0800, Thomas Nelson [EMAIL PROTECTED] wrote: My code: class Policy(list): def __cmp__(self,other): return cmp(self.fitness,other.fitness) j = Policy() j.fitness = 3 k = Policy() k.fitness = 1 l = Policy() l.fitness = 5 print max([j,k,l]).fitness prints 3,

Re: smtplib starttls gmail example

2007-01-23 Thread Jean-Paul Calderone
On Tue, 23 Jan 2007 17:25:24 GMT, py [EMAIL PROTECTED] wrote: from smtplib import SMTP from socket import sslerror #if desired server = SMTP('smtp.gmail.com') server.set_debuglevel(0) # or 1 for verbosity server.ehlo('[EMAIL PROTECTED]') server.starttls() server.ehlo('[EMAIL PROTECTED]')

Re: smtplib starttls gmail example

2007-01-23 Thread Jean-Paul Calderone
On Tue, 23 Jan 2007 23:48:59 GMT, py [EMAIL PROTECTED] wrote: Hi, Jean Paul. I read your code with interest. I wonder, does twisted also raise the socket error or does it know about this apparently well-known and often ignored incompatibility between the standard and the implementations?

Re: Wierd M2Crypto bug - phony peer did not return certificate error

2007-01-19 Thread Jean-Paul Calderone
On Fri, 12 Jan 2007 05:54:42 GMT, John Nagle [EMAIL PROTECTED] wrote: Heikki Toivonen wrote: [EMAIL PROTECTED] wrote: That's a problem for me. I need short timeouts; I'm accessing sites that might or might not have SSL support, and I need to quickly time out when there's no SSL server. You

Re: How to find out if another process is using a file

2007-01-18 Thread Jean-Paul Calderone
On Thu, 18 Jan 2007 14:34:52 -0300, Gabriel Genellina [EMAIL PROTECTED] wrote: Tom Wright [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] I'm writing a program which reads a series of data files as they are dumped into a directory by another process. At the moment, it gets

Re: how to write unicode to a txt file?

2007-01-17 Thread Jean-Paul Calderone
On 17 Jan 2007 08:28:14 -0800, Frank Potter [EMAIL PROTECTED] wrote: I want to change an srt file to unicode format so mpalyer can display Chinese subtitles properly. I did it like this: txt=open('dmd-guardian-cd1.srt').read() txt=unicode(txt,'gb18030') open('dmd-guardian-cd1.srt','w').write(txt)

Re: Globbing files by their creation date

2007-01-17 Thread Jean-Paul Calderone
On 17 Jan 2007 08:31:07 -0800, [EMAIL PROTECTED] wrote: Thanks a mill - os.path.getctime(f) is what I needed. Unfortunately, my attempts to turn the integer it returns into a date have failed. os.path.getctime(fn)#fn was created today, 1/17/2007 1168955503 I tried to convert this to a date

Re: Debugging SocketServer.ThreadingTCPServer

2007-01-16 Thread Jean-Paul Calderone
On Tue, 16 Jan 2007 00:23:35 -0500, Stuart D. Gathman [EMAIL PROTECTED] wrote: I have a ThreadingTCPServer application (pygossip, part of http://sourceforge.net/projects/pymilter). It mostly runs well, but occasionally goes into a loop. How can I get a stack trace of running threads to figure

Re: python - process id

2007-01-14 Thread Jean-Paul Calderone
On Sun, 14 Jan 2007 16:36:58 -0800, bruce [EMAIL PROTECTED] wrote: hi... is there a way to have a test python app, get its' own processID. i'm creating a test python script under linux, and was wondering if this is possible.. See the os module, the getpid function. also, i've tried using an

Re: context managers and generators

2007-01-12 Thread Jean-Paul Calderone
On 12 Jan 2007 06:17:01 -0800, [EMAIL PROTECTED] wrote: I'm happily using context managers and co-routines, and would like to use both at the same time, e.g. Python has generators, not co-routines. with foo(): ... x = yield y ... In this code multiple copies of this

Re: maximum number of threads

2007-01-10 Thread Jean-Paul Calderone
On Wed, 10 Jan 2007 12:11:59 -0200, Felipe Almeida Lessa [EMAIL PROTECTED] wrote: On 1/10/07, Laurent Pointal [EMAIL PROTECTED] wrote: This is a system configurable limit (up to a maximum). See ulimit man pages. test ulimit -a to see what are the current limits, and try with

Re: what is the idiom for copy lots of params into self?

2007-01-10 Thread Jean-Paul Calderone
On 10 Jan 2007 14:46:54 -0800, Emin [EMAIL PROTECTED] wrote: Dear Experts, When writing large classes, I sometimes find myself needing to copy a lot of parameters from the argument of __init__ into self. Instead of having twenty lines that all basically say something like self.x = x, I often use

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 same thing a few

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 borrows some

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 whether it

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. how can I

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: 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): ... return a, b, c

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 with the

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 Shed

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 uses this

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 support

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, 'The string

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 attachment. I

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 maintainers

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-Paul --

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: 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 wanted to

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 did, and it did

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 best way

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

<    4   5   6   7   8   9   10   11   >