Re: twisted: problem with sftp-client

2008-01-23 Thread Jean-Paul Calderone
On Wed, 23 Jan 2008 15:43:47 +0100, Kristian Domke <[EMAIL PROTECTED]> wrote: >Hello Folks, > >I don't know, if it is ok to post large portions of code, but I have >really no idea where the problem lies, so I don't have much of a choice. > >I am programming a tool, which in the end shall connect to

Re: IronPython vs CPython: faster in 1.6 times?

2008-02-05 Thread Jean-Paul Calderone
On Tue, 05 Feb 2008 14:22:39 -0500, "Mike C. Fletcher" > [snip] > >PyPy is attempting to address this issue via a separate interpreter, but >it's currently just playing catch-up on performance most of the time. >It does have a JIT, and might one day be fast enough to be a usable >replacement for C

Re: Code block function syntax, anonymous functions decorator

2008-02-06 Thread Jean-Paul Calderone
On Wed, 06 Feb 2008 23:59:27 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] schrieb: >> def run3( block ): >>for _ in range( 3 ): >> block() >> >> run3(): >>normal_suite() >> >> Introduces new syntax; arbitrary functions can follow 'colon'. >> >> Maintains re

Re: Why not a Python compiler?

2008-02-07 Thread Jean-Paul Calderone
On Thu, 07 Feb 2008 11:03:12 +0100, Stefan Behnel <[EMAIL PROTECTED]> wrote: >Santiago Romero wrote: > [snip] >> >> Why not a Python COMPILER? >> >> It would be very nice to be able to output Linux, MAC or Windows >> binaries of compiled (not bytecompiled) code. It would run faster, it >> will be

Re: use 'with' to redirect stdout

2008-02-11 Thread Jean-Paul Calderone
On Mon, 11 Feb 2008 10:37:18 -0500, Neal Becker <[EMAIL PROTECTED]> wrote: >This will work for stdout: > >from __future__ import with_statement >from contextlib import contextmanager >import sys > >@contextmanager >def redirect(newfile): >orig_stdout = sys.stdout >sys.stdout = newfile >

Re: use 'with' to redirect stdout

2008-02-11 Thread Jean-Paul Calderone
On Mon, 11 Feb 2008 09:15:07 -0500, Neal Becker <[EMAIL PROTECTED]> wrote: >Is there a simple way to use a 'with' statement to redirect stdout in a >block? Do you mean "without writing a context manager to do the redirection"? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: use 'with' to redirect stdout

2008-02-11 Thread Jean-Paul Calderone
On Mon, 11 Feb 2008 09:38:34 -0500, Neal Becker <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: > >> On Mon, 11 Feb 2008 09:15:07 -0500, Neal Becker <[EMAIL PROTECTED]> >> wrote: >>>Is there a simple way to use a 'with' statement to redirect

Re: linux disc space

2008-02-15 Thread Jean-Paul Calderone
On Fri, 15 Feb 2008 11:32:09 -0800, Jeff Schwab <[EMAIL PROTECTED]> wrote: >Chris wrote: >> On Feb 15, 7:10 pm, DataSmash <[EMAIL PROTECTED]> wrote: >>> I simply want to capture the free disc space in a variable so that I >>> can compare changes. I'm aware of a few commands like "df -h" or "du - >

Re: Could WSGI handle Asynchronous response?

2008-02-18 Thread Jean-Paul Calderone
On Mon, 18 Feb 2008 05:27:41 -0800 (PST), est <[EMAIL PROTECTED]> wrote: >On Feb 18, 7:05 pm, est <[EMAIL PROTECTED]> wrote: >> I am writing a small 'comet'-like app using flup, something like this: >> >> def myapp(environ, start_response): >> start_response('200 OK', [('Content-Type', 'text/pl

Re: Could WSGI handle Asynchronous response?

2008-02-18 Thread Jean-Paul Calderone
On Mon, 18 Feb 2008 06:48:26 -0800 (PST), est <[EMAIL PROTECTED]> wrote: > [snip] > >So, is there any solution that handles this nicely? Or, more >specificly, is there any solution that is more 'comet'-like, let's say >'socket'-like than WSGI which could almost do full-dulex HTTP >communications, a

Re: Is there any python lib for NAT transversal?

2008-02-21 Thread Jean-Paul Calderone
On Thu, 21 Feb 2008 14:50:50 +0800, hawk gao <[EMAIL PROTECTED]> wrote: >Is there any python lib for NAT transversal? Divmod Vertex is such a library (it does a few other things as well), but it is not nearly complete and has little documentation. http://divmod.org/trac/wiki/DivmodVertex Jean-Pa

Re: Python Telnet formatting?

2008-03-02 Thread Jean-Paul Calderone
On Sat, 1 Mar 2008 16:51:08 -0800 (PST), [EMAIL PROTECTED] wrote: >Hi everyone: > >I posted here a couple days ago looking for some help creating a >Telnet-based chat server. You guys pointed me to Twisted, which has >solved most of my issues. > >However, what I want to do is analyze strings receiv

Re: is there enough information?

2008-03-03 Thread Jean-Paul Calderone
On Tue, 26 Feb 2008 21:45:24 -0800, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > [snip] > > Threads, in Python, are good for parallel processing of items that >tend to be I/O bound -- that is, stuff that blocks on lots of I/O calls >allowing other threads to execute until they block too. Du

Re: mulithreaded server

2008-03-11 Thread Jean-Paul Calderone
On Tue, 11 Mar 2008 08:24:54 -0700 (PDT), asit <[EMAIL PROTECTED]> wrote: >import socket >import sys >import thread > >p=1 >PORT=11000 >BUFSIZE=1024 > >def getData(cSocket): >global stdoutlock,cSocketlock >while True: >cSocketlock.acquire() >data=cSocket.recv(BUFSIZE) >

Re: Does __import__ require a module to have a .py suffix?

2008-03-12 Thread Jean-Paul Calderone
On Wed, 12 Mar 2008 12:58:33 -0700 (PDT), George Sakkis <[EMAIL PROTECTED]> wrote: >On Mar 12, 12:22 pm, mrstephengross <[EMAIL PROTECTED]> wrote: > >> Hi all. I've got a python file called 'foo' (no extension). I want to >> be able to load it as a module, like so: >> >> m = __import__('foo') >>

Re: Psyco alternative

2008-03-27 Thread Jean-Paul Calderone
On Thu, 27 Mar 2008 15:19:11 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Ok, i know this. The one that i do not know, is if, let'say, in 2 >> years it will be ready for seriously development, PyPy will aim to >> "replace" CPython entirely ?? We are talking about an whole new >> distrib

Re: Psyco alternative

2008-03-27 Thread Jean-Paul Calderone
On Thu, 27 Mar 2008 08:59:33 -0700 (PDT), [EMAIL PROTECTED] wrote: >Diez B. Roggisch: >> the author says that the approach is flawed, so at *some* >> point it will be discontinued. > >Can't Psyco be improved, so it can compile things like: > >nums = (i for i in xrange(20) if i % 2) >print sum(n

Re: subprocess.Popen stalls

2009-01-12 Thread Jean-Paul Calderone
On Mon, 12 Jan 2009 06:37:35 -0800 (PST), "psaff...@googlemail.com" wrote: I'm building a bioinformatics application using the ipcress tool: http://www.ebi.ac.uk/~guy/exonerate/ipcress.man.html I'm using subprocess.Popen to execute ipcress, which takes a group of files full of DNA sequences a

Re: executing multiple functions in background simultaneously

2009-01-14 Thread Jean-Paul Calderone
On Wed, 14 Jan 2009 17:11:44 -0800, Catherine Moroney wrote: [snip] The easy thing is to use a Queue object. The background thread uses .put() to place a computed result on the QUeue and the caller uses .get() to read from the queue. There's an assortment of other ways too. Cheers, Thank y

Re: wsgi silently swallows errors

2009-01-19 Thread Jean-Paul Calderone
On Mon, 19 Jan 2009 12:15:29 -0800, Ron Garret wrote: Consider the following wsgi app: def application(env, start_response): start_response('200 OK',[('Content-type','text/plain')]) yield "hello" x=1/0 yield "world" The result of this is that the web browser displays "hello" and an error m

Re: seeking to improve Python skills

2009-01-23 Thread Jean-Paul Calderone
On Fri, 23 Jan 2009 12:17:41 +0100, mk wrote: Hello everyone, I wrote the following program mainly for educational purpose of improving my Python programming skills -- would Pythonistas here please look at it and point out areas that could use improvement? This thing analyzes the stored loa

Re: seeking to improve Python skills

2009-01-23 Thread Jean-Paul Calderone
On Fri, 23 Jan 2009 16:57:16 +0100, mk wrote: Jean-Paul Calderone wrote: The most significant thing missing from this code is unit tests. Developing automated tests for your code will help you learn a lot. Thanks for all the remarks, I'll restructure my code. Probably the biggest mi

Re: Where to place imports

2009-01-23 Thread Jean-Paul Calderone
On 23 Jan 2009 18:50:00 GMT, Duncan Booth wrote: [snip] BTW, if you ever find you are starting to write multi-threaded applications then you'll really regret it if you reuse code which does imports from inside functions. If two or more threads try to import a module simultaneously then one of t

Re: Where to place imports

2009-01-23 Thread Jean-Paul Calderone
On Fri, 23 Jan 2009 22:49:34 +0100, Christian Heimes wrote: Jean-Paul Calderone schrieb: BTW, if you ever find you are starting to write multi-threaded applications then you'll really regret it if you reuse code which does imports from inside functions. If two or more threads try to imp

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Jean-Paul Calderone
On Mon, 26 Jan 2009 13:26:56 -0800 (PST), jefm wrote: As Benjamin Kaplin said, Windows terminals use the old cp1252 character set, which cannot display the euro sign. You'll either have to run it in something more modern like the cygwin rxvt terminal, or output some other way, such as through a

Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Address already in use')

2009-01-27 Thread Jean-Paul Calderone
On Tue, 27 Jan 2009 10:49:03 +0100, Laszlo Nagy wrote: I have a program that uses socket.bind() and socket.listen() frequently. After that program stops, it is not able to bind() again for a while: File "/home/gandalf/Python/Lib/orb/accesspoints/srvtcp.py", line 27, in __init__ self.serve

Re: A Twisted Design Decision

2009-01-27 Thread Jean-Paul Calderone
On Tue, 27 Jan 2009 05:46:25 -0800 (PST), koranthala wrote: Twisted, being twisted in its behavior is causing quite a lot of confusion in design decisions. I'm not sure I agree with your premise. ;) I will put forward a comparison of reactor and non-reactor patterns. The code is not exact -

Re: A Twisted Design Decision

2009-01-28 Thread Jean-Paul Calderone
On Wed, 28 Jan 2009 02:02:57 -0800 (PST), koranthala wrote: On Jan 27, 9:27 pm, koranthala wrote: On Jan 27, 6:57 pm, Jean-Paul Calderone wrote: [snip] Thank you Jean-Paul. My code is more complex than what I have mentioned. When I mentioned msg.send, the msg object actually gets the

Re: A Twisted Design Decision

2009-01-28 Thread Jean-Paul Calderone
On Wed, 28 Jan 2009 06:30:32 -0800 (PST), koranthala wrote: On Jan 28, 7:10 pm, Jean-Paul Calderone wrote: On Wed, 28 Jan 2009 02:02:57 -0800 (PST), koranthala wrote: >On Jan 27, 9:27 pm, koranthala wrote: >> On Jan 27, 6:57 pm, Jean-Paul Calderone wrote: > [snip] >> T

Re: A Twisted Design Decision

2009-01-28 Thread Jean-Paul Calderone
On Wed, 28 Jan 2009 08:05:13 -0800 (PST), koranthala wrote: On Jan 28, 8:36 pm, Jean-Paul Calderone wrote: [snip] Why isn't the return value of protocol.send propagated back to msg.send? It sounds like it should be. Jean-Paul Thank you very much again Jean-Paul for helping me out.

Re: Sloooooowwwww WSGI restart

2009-01-28 Thread Jean-Paul Calderone
On Wed, 28 Jan 2009 13:35:56 -0800, Ron Garret wrote: I'm running a WSGI app under apache/mod_wsgi and I've noticed that whenever I restart the server after making a code change it takes a very long time (like a minute) before the script is active again. In other words, I do an apachectl restar

Re: Results of executing hyperlink in script

2009-01-28 Thread Jean-Paul Calderone
On Wed, 28 Jan 2009 23:14:59 +, MRAB wrote: Muddy Coder wrote: Hi Folks, My previous post got a many helps from the people, and I tested what they suggested. Since this topic maybe needed in future, so I drop these lines below to help the future programmers. The methods worked as below: 1

Re: persistent TCP connection in python using socketserver

2009-01-29 Thread Jean-Paul Calderone
On Thu, 29 Jan 2009 08:38:43 -0800 (PST), markobrie...@gmail.com wrote: G'day I'm currently using socketserver to build a simple XMLSocket (an XML based protocol used for communication between flash and the outside world) server. I've got flash establishing a connection, sending a request and my

Re: Get thread pid

2009-01-30 Thread Jean-Paul Calderone
On Fri, 30 Jan 2009 06:56:10 -0800 (PST), Alejandro wrote: On Jan 30, 4:00 am, Ove Svensson wrote: Pidis a process identifier. Threads are not processes. All your threads execute within the context if a single process, hence they should have the samepid. Threads may have athreadid but it is n

Announcing Pyflakes 0.3.0

2009-01-30 Thread Jean-Paul Calderone
code. It is a handy supplement to your project's test suite. Read more about Pyflakes and the 0.3.0 release on the website: http://divmod.org/trac/wiki/DivmodPyflakes Jean-Paul Calderone Divmod, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Get thread pid

2009-01-30 Thread Jean-Paul Calderone
On Fri, 30 Jan 2009 08:33:53 -0800 (PST), Alejandro wrote: On Jan 30, 9:11 am, Jean-Paul Calderone wrote: [clarification about threads] Thank you for the clarification. I will reformulate my question: pstree and also ntop (but not top) show a number for each thread, like for instance

Re: Odd syntactic NON-error?

2009-01-30 Thread Jean-Paul Calderone
On Fri, 30 Jan 2009 11:36:45 -0600, Alaric Haag wrote: Hello, I just noticed that I've been successfully importing a module I wrote which contains a class definition that begins with (docstring removed): class TDF(): def __init__(self, name='', mode=tscan. GP_NOCLOBBER): Note the "space" w

Re: persistent TCP connection in python using socketserver

2009-02-03 Thread Jean-Paul Calderone
On Sat, 31 Jan 2009 09:31:52 -0800 (PST), markobrie...@gmail.com wrote: [snip] Cheers mate I had a look into twisted but was put off by the FAQ stating 1.0+ modules may or may not be stable, and only the 'core' is. I don't wanna be messing around with a potentially buggy server, so im gonna roll

Re: Running all unit tests

2009-02-06 Thread Jean-Paul Calderone
On Fri, 06 Feb 2009 21:11:15 -0500, Jason Voegele wrote: I'm working on my first substantial Python project, and I'm following a fully test-first approach. I'd like to know how Pythonistas typically go about running all of their tests to ensure that my application stays "green". In Ruby, I wou

Re: Portable way to refer to the null device?

2009-02-07 Thread Jean-Paul Calderone
On Sat, 7 Feb 2009 15:56:45 -0800, n...@stinemates.org wrote: On Fri, Feb 06, 2009 at 07:32:20PM -0800, Roy Smith wrote: I need to run a command using subprocess.Popen() and have stdin connected to the null device. On unix, I would do: self.process = subprocess.Popen(argv,

Re: convert the ip packet to and from RS-232 packet

2009-02-09 Thread Jean-Paul Calderone
On Mon, 9 Feb 2009 05:13:10 -0800 (PST), Li Han wrote: Hi, I need to use radio to connect two local ip network, each local network has a server computer which connects to a radio with RS-232 interface. I need to write a program to convert the local ip packet into RS-232 packet, so the radio can

Re: Small socket problem

2009-02-09 Thread Jean-Paul Calderone
On Mon, 9 Feb 2009 09:43:36 +, John O'Hagan wrote: Hi, I'm using the socket module (python 2.5) like this (where 'options' refers to an optparse object) to connect to the Fluidsynth program: host = "localhost" port = 9800 fluid = socket(AF_INET, SOCK_STREAM

Re: thread. question

2009-02-09 Thread Jean-Paul Calderone
On Mon, 09 Feb 2009 15:34:02 +, Tim Wintle wrote: Thanks for both replies, On Mon, 2009-02-09 at 15:59 +0100, Christian Heimes wrote: You shouldn't use the thread module directly. It's not meant to be used by a user. Please stick to the threading module. You won't notice a slowdown, trust

Re: "Super()" confusion

2009-02-09 Thread Jean-Paul Calderone
On Mon, 9 Feb 2009 15:20:05 -0800 (PST), Lionel wrote: Hello. I've been scouring the web looking for something to clear up a little confusion about the use of "super()" but haven't found anything that really helps. Here's my simple example: [snip] "super(Child,self).__init__(filePath) TypeErro

Re: "Super()" confusion

2009-02-09 Thread Jean-Paul Calderone
On Mon, 9 Feb 2009 16:18:34 -0800 (PST), Lionel wrote: On Feb 9, 4:04 pm, Jean-Paul Calderone wrote: On Mon, 9 Feb 2009 15:20:05 -0800 (PST), Lionel wrote: >Hello. I've been scouring the web looking for something to clear up a >little confusion about the use of "super()&qu

Re: "Super()" confusion

2009-02-09 Thread Jean-Paul Calderone
On Mon, 9 Feb 2009 17:19:41 -0800, Daniel Fetchinson wrote: Hello. I've been scouring the web looking for something to clear up a little confusion about the use of "super()" but haven't found anything that really helps. Here's my simple example: [snip] "super(Child,self).__init__(filePath) Ty

Re: "Super()" confusion

2009-02-09 Thread Jean-Paul Calderone
On Mon, 9 Feb 2009 17:34:05 -0800, Daniel Fetchinson wrote: Hello. I've been scouring the web looking for something to clear up a little confusion about the use of "super()" but haven't found anything that really helps. Here's my simple example: [snip] "super(Child,self).__init__(filePath) Ty

Re: "Super()" confusion

2009-02-10 Thread Jean-Paul Calderone
On Tue, 10 Feb 2009 19:40:56 + (UTC), Benjamin Peterson wrote: Marc 'BlackJack' Rintsch gmx.net> writes: On Tue, 10 Feb 2009 02:02:43 +, Benjamin Peterson wrote: > Jean-Paul Calderone divmod.com> writes: >> Consider whether you really need to use super

Re: Escaping my own chroot...

2009-02-11 Thread Jean-Paul Calderone
On Wed, 11 Feb 2009 09:31:56 -0600, Nick Craig-Wood wrote: r0g wrote: I'm writing a linux remastering script in python where I need to chroot into a folder, run some system commands and then come out and do some tidying up, un-mounting proc & sys etc. I got in there with os.chroot() and I

Re: select.poll.poll() never blocks

2009-02-11 Thread Jean-Paul Calderone
On Wed, 11 Feb 2009 18:44:53 -0800 (PST), birdsong wrote: I'm pretty sure I've exhausted all searches and read all the forums Google will turn up related to this issue. I touch an empty file in a sh shell, fire up the python shell, open the file for reading(tried all buffering options), regist

Re: Can't load smtplib

2009-02-12 Thread Jean-Paul Calderone
On Thu, 12 Feb 2009 11:40:57 -0800 (PST), S-boy wrote: I can't seem to import smtplib in either a script or the command line interpreter. When I try to import smtp, there seems to be some kind of collision with urllib2. I get a weird error about Web server authorization, even though I'm not cal

Re: Threads in PyGTK: keep typing while ping-ing

2009-02-16 Thread Jean-Paul Calderone
On Mon, 16 Feb 2009 05:47:22 -0800 (PST), Mamahita Sela wrote: Dear All, I have read several howtos for threading in PyGTK. I have tried some but with no luck. What i want is: i can keep typing in gtk.TextView while periodically doing ping some hosts. You don't need threads for this. The

Re: os.fdopen giving "Invalid Argument" from pipes

2009-02-19 Thread Jean-Paul Calderone
On Thu, 19 Feb 2009 16:37:49 +, Tim Wintle wrote: Was wondering if someone could point out what the stupid thing I'm doing wrong is: {{{ import os, time def run_multi_proc(): server_send, logger_recieve = os.pipe() You got server_send and logger_receive backwards (also, i before e *e

Re: FTP libs for Python?

2009-02-20 Thread Jean-Paul Calderone
On Fri, 20 Feb 2009 06:22:29 -0800 (PST), Thomas Allen wrote: I'm interested in writing a script to ease deployment of minor changes on some websites here, and it would involve some SFTP transfers. Do you know of good alternatives to ftplib, which is relatively low- level? Twisted includes FT

Re: Version upgrade blocked mentally

2008-11-29 Thread Jean-Paul Calderone
On Sat, 29 Nov 2008 13:40:00 -0800, Scott David Daniels <[EMAIL PROTECTED]> wrote: Adam E wrote: I have read in my copy of Programming Python that all strings will be Unicode and there will be a byte type. Actually that change is scheduled for 3.0. Yes, but it's available in 2.6 as well:

Re: Project structure - Best practices

2008-11-30 Thread Jean-Paul Calderone
On Sun, 30 Nov 2008 17:43:46 +0100, Filip Gruszczyński <[EMAIL PROTECTED]> wrote: This is first time that I am building python application that is larger than a single module and I would like to do it right. I google it a bit, finding some stuff about not using src directory (which I have seen s

Re: schizophrenic view of what is white space

2008-12-04 Thread Jean-Paul Calderone
On Thu, 04 Dec 2008 14:27:49 +, Robin Becker <[EMAIL PROTECTED]> wrote: Is python of two minds about what is white space. I notice that split, strip seem to regard u'\xa0' (NO-BREAK SPACE) as white, but that code is not matched by the \s pattern. If this difference is intended can we rely on

Re: Python 3 read() function

2008-12-04 Thread Jean-Paul Calderone
On Thu, 04 Dec 2008 14:25:48 -0500, Terry Reedy <[EMAIL PROTECTED]> wrote: [snip] In my test, I read Python25.chm with 2.5 and Python30.chm with 3.0. Rereading Python30.chm without closing *is* much faster. >>> f=open('Doc/Python30.chm','rb') >>> d=f.read() >>> d=f.read() >>> d=f.read() Did y

Re: schizophrenic view of what is white space

2008-12-04 Thread Jean-Paul Calderone
On Thu, 04 Dec 2008 22:40:46 +0100, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: [snip] Whitespace is probably not controversial, but many parsers tend to expect things like \d to match [0-9], not any Unicode character marked as "digit". For example, I'm not sure if this behavior would be a good de

Re: Checking if an int fits in 32 bits?

2008-12-04 Thread Jean-Paul Calderone
On Thu, 4 Dec 2008 12:11:08 -0800 (PST), Roy Smith <[EMAIL PROTECTED]> wrote: I'm working with marshaling data over a binary wire protocol. I'm using struct.pack() to handle the low-level encoding of ints. One of the things I need to do is make sure an int can be represented in 4 bytes. Is the

Re: Equivalent of 'wget' for python?

2008-12-08 Thread Jean-Paul Calderone
On Mon, 08 Dec 2008 17:29:35 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: Robert Dailey wrote: Hi, I'm looking for a portable way to download ZIP files on the internet through Python. I don't want to do os.system() to invoke 'wget', since this isn't portable on Windows. I'm hoping the

Re: StringIO in 2.6 and beyond

2008-12-10 Thread Jean-Paul Calderone
On 10 Dec 2008 11:58:37 GMT, Bill McClain <[EMAIL PROTECTED]> wrote: On 2008-12-10, ajaksu <[EMAIL PROTECTED]> wrote: On Dec 9, 5:24 pm, Bill McClain <[EMAIL PROTECTED]> wrote: > On 2008-12-09, MRAB <[EMAIL PROTECTED]> wrote: > > > In Python 2.x unmarked string literals are bytestrings. In Pytho

Re: %s place holder does not let me insert ' in an sql query with python.

2008-12-15 Thread Jean-Paul Calderone
On Mon, 15 Dec 2008 18:16:18 +0530, Krishnakant wrote: hello all hackers. This is some kind of an interesting situation although many of you must have already gone through it. I am facing a situation where I have to use psycopg2 and insert rows in a postgresql table. That's pritty easy and no ne

Re: AIM client code for Python?

2008-12-16 Thread Jean-Paul Calderone
On Tue, 16 Dec 2008 10:54:38 -0700, Joe Strout wrote: I'd like to write an AIM bot in Python. I found and tried , but it doesn't work for me: Connecting... Traceback (most recent call last): File "aimbot-1.py", line 17, in bot.go() File "/Users/jstrout/Do

Re: Can anyone suggest a good HTTP/1.1 web client?

2008-12-16 Thread Jean-Paul Calderone
On Tue, 16 Dec 2008 12:18:17 -0800 (PST), Kottiyath wrote: Hi all, I have to connect to a secure website every second to get the data and then post to it. I have been investigating on many web clients in python, but nothing fits the bill properly. The ones I tried implementing are: 1.

Re: Can anyone suggest a good HTTP/1.1 web client?

2008-12-16 Thread Jean-Paul Calderone
On Tue, 16 Dec 2008 18:47:41 -0800 (PST), Kottiyath wrote: If you'd like to help out with the new Twisted HTTP client, that would be wonderful.  Even if you can just try it out and report any problems you run into, that would be immensely helpful. Jean-Paul I would love to help out with th

Re: getting object instead of string from dir()

2008-12-17 Thread Jean-Paul Calderone
On Wed, 17 Dec 2008 11:52:17 -0800 (PST), Rominsky wrote: On Dec 17, 10:59 am, Christian Heimes wrote: Rominsky schrieb: > I am trying to use dir to generate a list of methods, variables, etc. > I would like to be able to go through the list and seperate the > objects by type using the type(

Re: Transferring a file over sockets

2008-12-17 Thread Jean-Paul Calderone
On Wed, 17 Dec 2008 17:41:46 +0530, Ferdinand Sousa wrote: I am using sockets to transfer a file over LAN. There are 2 scripts, the server opens a listens for connection and the client is run on another machine. I always make sure the server is run first. The strange thing is that if the the se

Re: confused about __str__ vs. __repr__

2008-12-18 Thread Jean-Paul Calderone
On Thu, 18 Dec 2008 09:51:01 -0500, Neal Becker wrote: Tino Wildenhain wrote: Neal Becker wrote: ... So if __str__ is "meant for human eyes", then why isn't print using it! it is: > print x str but dict just uses repr() for all its childs to print. T. That makes no sense to me. If I ca

Re: IMAP: How to implement GMail-like threaded conversations view

2008-12-19 Thread Jean-Paul Calderone
On Fri, 19 Dec 2008 08:47:18 -0800 (PST), Martin wrote: Currently I am trying to get used to Python's imaplib and email modules. I'like to create a webmail client simmilar to GMail. I'd suggest using Twisted's IMAP4 client. It's somewhat easier to use than Python's imaplib because it does muc

Re: New Python 3.0 string formatting - really necessary?

2008-12-19 Thread Jean-Paul Calderone
On Fri, 19 Dec 2008 10:27:27 -0700, Michael Torrie wrote: walterbyrd wrote: On Dec 19, 9:13 am, "Giampaolo Rodola'" wrote: You can use the old 2.x syntax also in Python 3.x: Yeah, but it's deprecated, and - as I understand it - may be removed completely in future versions. Also, in the futu

Re: Event Driven programming - Doubts

2008-12-22 Thread Jean-Paul Calderone
On Mon, 22 Dec 2008 06:57:55 -0800 (PST), Kottiyath wrote: Hi, I have been looking at Twisted and lately Circuits as examples for event driven programming in Python. [snip] My question is as follows: I have not understood how the callbacks are hit without (a) blocking the code or (b)

Re: select.select and socket.setblocking

2008-12-30 Thread Jean-Paul Calderone
On Tue, 30 Dec 2008 19:19:08 +0100, Francesco Bochicchio wrote: [snip] If you are interested in socket errors, you should also fill the third 'fd-set' in the select call, and after select returns check that fd is not in it anymore: ready = select.select( [fd],[], [fd] ) if fd in ready[2]:

Re: Triple quoted string in exec function ?

2008-12-30 Thread Jean-Paul Calderone
On Tue, 30 Dec 2008 21:16:39 +0100, Stef Mientki wrote: ibpe...@gmail.com wrote: On Dec 30, 2:48 pm, Steve Holden wrote: Stef Mientki wrote: hello, I'm running scripts, with the execute function (Python 2.5), and it seems that triple quoted strings are not allowed. Is there a w

Re: select.select and socket.setblocking

2008-12-30 Thread Jean-Paul Calderone
On Tue, 30 Dec 2008 14:41:17 -0600, Grant Edwards wrote: On 2008-12-30, Francesco Bochicchio wrote: 3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in select between blocking and non-blocking mode. The difference is in the recv (again, assuming that you use TCP as protocol

Re: select.select and socket.setblocking

2008-12-30 Thread Jean-Paul Calderone
On Tue, 30 Dec 2008 15:55:51 -0500, Jean-Paul Calderone wrote: On Tue, 30 Dec 2008 14:41:17 -0600, Grant Edwards wrote: On 2008-12-30, Francesco Bochicchio wrote: 3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in select between blocking and non-blocking mode. The

Re: select.select and socket.setblocking

2008-12-31 Thread Jean-Paul Calderone
On Wed, 31 Dec 2008 15:48:50 +0100, Francesco Bochicchio wrote: < ... > Uhm. In my experience, with TCP protocol recv only returned less than the required bytes if the remote end disconnects. I always check the What if the sending end actually sent less than you asked for ? -srp In blocki

Re: If your were going to program a game...

2009-01-02 Thread Jean-Paul Calderone
On Fri, 2 Jan 2009 09:44:55 -0800 (PST), Fuzzyman wrote: On Jan 2, 3:02 pm, J Kenneth King wrote: Tokyo Dan writes: > If your were going to program a game in python what technologies would > you use? > The game is a board game with some piece animations, but no movement > animation...think o

Re: Doubt on creating threads

2009-01-03 Thread Jean-Paul Calderone
On Sat, 3 Jan 2009 08:39:52 -0800 (PST), koranth...@gmail.com wrote: I was going through Python posts and this post caught my attention http://groups.google.com/group/comp.lang.python/browse_thread/thread/f99326a4e5d394e/14cd708956bd1c1a#14cd708956bd1c1a You have missed an important point. A we

Re: Python callback functions and static methods

2009-01-05 Thread Jean-Paul Calderone
On Mon, 5 Jan 2009 18:00:37 +0100, Joris wrote: Hello, I'm trying to implement callback functionality in a static class. I have a feeling that I'm doing something against the Python philosophy and not some programming error but any help would be appreciated. Others have explained what was w

Re: Defer problem

2009-01-07 Thread Jean-Paul Calderone
On Wed, 7 Jan 2009 04:44:43 -0800 (PST), wladimir wrote: Hi, I have an problem. I want to fire one callback after n callbacks fired, but when i fire one callback all the chain will be executed. Example: def handle(x): print 'callback ' + str(x) def handle2(x): print 'after callbacks'

Re: ssl module - how can I accept SSLv3 and TLSv1 protocols only?

2009-01-07 Thread Jean-Paul Calderone
On Tue, 6 Jan 2009 19:01:48 -0800 (PST), Giampaolo Rodola' wrote: Hi, I'm trying to add TLS/SSL support to pyftpdlib. Since various defects have been found in the SSLv2 protocol many FTPS servers (i.e. proftpd and vsftpd) decided to support SSLv3 and TLSv1 only and sistematically reject any cli

Re: HARD REAL TIME PYTHON

2008-10-06 Thread Jean-Paul Calderone
On Tue, 7 Oct 2008 09:32:37 +1000, James Mills <[EMAIL PROTECTED]> wrote: On Tue, Oct 7, 2008 at 9:25 AM, Blubaugh, David A. <[EMAIL PROTECTED]> wrote: close to real time constraints? For example is it possible to develop a python program that can address an interrupt or execute an operation wit

Re: HARD REAL TIME PYTHON

2008-10-06 Thread Jean-Paul Calderone
On Tue, 7 Oct 2008 12:10:44 +1000, James Mills <[EMAIL PROTECTED]> wrote: On Tue, Oct 7, 2008 at 11:48 AM, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: Indeed, this looks wrong - or at least inconclusive. The benchmark above demonstrates throughput, not minimum (or maximum, or

Re: How do you get rid of useless warnings?

2008-10-07 Thread Jean-Paul Calderone
On Tue, 07 Oct 2008 14:12:06 -0400, Terry Reedy <[EMAIL PROTECTED]> wrote: Peter Otten wrote: Grant Edwards wrote: I'm getting awfully tired of constant warnings about what's going to happen at some point in the future. Warnings like this: ./surfplot.py:313: Warning: 'with' will become a rese

Re: Reading from stdin

2008-10-08 Thread Jean-Paul Calderone
On Wed, 8 Oct 2008 09:28:55 -0400, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote: On Tuesday 07 October 2008 11:27:19 pm George Sakkis wrote: """ In order to make a for loop the most efficient way of looping over the lines of a file (a very common operation), the next() method uses a hidden read-ah

Re: How to calculate two time?

2008-10-08 Thread Jean-Paul Calderone
On Wed, 8 Oct 2008 06:49:10 -0700 (PDT), lookon <[EMAIL PROTECTED]> wrote: I have two string like "2007-03-27T08:54:43+08:00 " how do I get the hours between these two time(string format)? That's ISO 8601 datetime format. You might use epsilon.extime: >>> from epsilon.extime import Time

Re: Twisted Matrix and multicast broadcast

2008-10-09 Thread Jean-Paul Calderone
On Thu, 9 Oct 2008 06:03:44 -0700 (PDT), Stodge <[EMAIL PROTECTED]> wrote: [snip] class MulticastServerUDP(DatagramProtocol): def startProtocol(self): print 'Started Listening' # Join a specific multicast group, which is the IP we will respond to self.transport.joinGroup('

Re: About print exception message

2008-10-09 Thread Jean-Paul Calderone
On Thu, 9 Oct 2008 06:37:04 -0700 (PDT), WaterWalk <[EMAIL PROTECTED]> wrote: Until Python 2.5, the exception object still uses ansi string. Thus, in the following example: f = open(u"\u6d4b.log") Suppose the file to open does not exist, the output message of the exception maybe like: [Errno 2

Re: Suggestion for the PythonDevelopment for next version

2008-10-13 Thread Jean-Paul Calderone
On Mon, 13 Oct 2008 08:56:34 -0700 (PDT), azrael <[EMAIL PROTECTED]> wrote: You know, sometimes it annoys me to write a for loop in Python. If we use a list a=[1,2,3,4], and want to loop through it, Python offers the next option for i in a: print i 1 2 3 4 I love this. So simple and smooth.

Re: Linux.com: Python 3 makes a big break

2008-10-18 Thread Jean-Paul Calderone
On Sat, 18 Oct 2008 15:30:23 -0400, Terry Reedy <[EMAIL PROTECTED]> wrote: http://www.linux.com/feature/150399 Interesting article with one minor incompleteness. "For instance, the print statement got turned into a print function; you must now put parentheses around what you want to print to the

Re: add method to class dynamically?

2008-10-22 Thread Jean-Paul Calderone
On Wed, 22 Oct 2008 08:29:08 -0400, Neal Becker <[EMAIL PROTECTED]> wrote: I have a class (actually implemented in c++ using boost::python). For an instance of this class, 'r', I'd like to support len (r). I don't want to add it to the c++ code, because this is a unique situation: this class

Re: how to pass a dictionary (including chinese characters) through Queue as is?

2008-10-25 Thread Jean-Paul Calderone
On Sat, 25 Oct 2008 08:36:22 -0700 (PDT), ouyang <[EMAIL PROTECTED]> wrote: Hi everyone, As indicated in the following python script, the dictionary b has Chinese characters: "中文". But a.get() returns the dictionary with a little bit different format for the "中文“: '\xd6\xd0\xce\xc4' . How ca

Re: memory mapped tar file contents

2008-11-12 Thread Jean-Paul Calderone
On Wed, 12 Nov 2008 18:51:38 -0800 (PST), Chris Brooks <[EMAIL PROTECTED]> wrote: Hi, I would like to read directly from a tar file into memory so I can manipulate a file (quickly) and write its changes out to another file. I thought I could do something like: If you mmap a tar file, then y

Re: Text based screens without ncurses

2008-11-13 Thread Jean-Paul Calderone
On Thu, 13 Nov 2008 20:11:30 +0200, Mirat Can Bayrak <[EMAIL PROTECTED]> wrote: Hi, i'll try to write a editor in python, i want it run under terminal (no qt or gtk) but i dont want to use urwid or curses modules. Why don't you want to use one of these libraries for doing the thing that you wa

Re: Text based screens without ncurses

2008-11-13 Thread Jean-Paul Calderone
On Thu, 13 Nov 2008 20:16:58 +0200, Mirat Can Bayrak <[EMAIL PROTECTED]> wrote: On Thu, 13 Nov 2008 12:14:10 -0500 Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: Why don't you want to use one of these libraries for doing the thing that you want to do? mmm lets say i want

Re: using "private" parameters as static storage?

2008-11-13 Thread Jean-Paul Calderone
On Thu, 13 Nov 2008 10:58:49 -0800 (PST), [EMAIL PROTECTED] wrote: On Nov 13, 11:32 am, "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote: On Thu, 2008-11-13 at 09:38 -0800, Matimus wrote: [snip] > Preserving state is what classes are for. Preserving state is what *objects* are for. Not exclusively

Re: Problem with writing fast UDP server

2008-11-20 Thread Jean-Paul Calderone
On Fri, 21 Nov 2008 00:20:49 -0200, Gabriel Genellina <[EMAIL PROTECTED]> wrote: En Thu, 20 Nov 2008 14:24:20 -0200, Krzysztof Retel <[EMAIL PROTECTED]> escribió: On Nov 20, 4:00 pm, [EMAIL PROTECTED] wrote: On 20 Nov, 16:03, Krzysztof Retel <[EMAIL PROTECTED]> wrote: > I am struggling writing

Re: Extract CDATA Node

2009-02-24 Thread Jean-Paul Calderone
On Tue, 24 Feb 2009 05:29:21 -0800 (PST), Girish wrote: How do I extract CDATA node in Python? I'm using dom.minidom as follows:- from xml.dom.minidom import Document class XMLDocument(): def __init__(self): self.doc = Document() def parseString(self, d): self.doc = pars

Re: "Battleship" style game

2009-02-25 Thread Jean-Paul Calderone
On Wed, 25 Feb 2009 15:54:46 -0500, Shawn Milochik wrote: On Wed, Feb 25, 2009 at 3:15 PM, Diez B. Roggisch wrote: Not really. The point about properties is that you *can* make attribute access trigger getter or setter code. But not that you do unless there is an actual reason for that. The

<    1   2   3   4   5   6   7   >