Re: marshal vs pickle

2007-11-01 Thread Jean-Paul Calderone
On Thu, 01 Nov 2007 21:15:06 -, Aaron Watters [EMAIL PROTECTED] wrote: On Nov 1, 4:59 pm, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On Thu, 01 Nov 2007 20:35:15 -, Aaron Watters [EMAIL PROTECTED] wrote: On Nov 1, 2:15 pm, Raymond Hettinger [EMAIL PROTECTED] wrote: On Nov 1, 4:45 am

Re: Python bug tracker now secret?

2007-10-31 Thread Jean-Paul Calderone
On Wed, 31 Oct 2007 07:53:01 -0700, John Nagle [EMAIL PROTECTED] wrote: I'm now getting messages like this from the Python bug tracker on SourceForge: Artifact: This Artifact Has Been Made Private. Only Group Members Can View Private ArtifactTypes. I'm being denied access to bug reports I

Re: Python bug tracker now secret?

2007-10-31 Thread Jean-Paul Calderone
On Wed, 31 Oct 2007 08:26:06 -0700, John Nagle [EMAIL PROTECTED] wrote: Jean-Paul Calderone wrote: On Wed, 31 Oct 2007 07:53:01 -0700, John Nagle [EMAIL PROTECTED] wrote: I'm now getting messages like this from the Python bug tracker on SourceForge: Artifact: This Artifact Has Been Made

Re: Python bug tracker now secret?

2007-10-31 Thread Jean-Paul Calderone
On Wed, 31 Oct 2007 16:42:48 +0100, \Martin v. Löwis\ [EMAIL PROTECTED] wrote: I don't know why they chose to make the sf tracker private. Maybe that was the only way to remove write access. That, plus removing it means that people won't browse outdated information. Though it also means all

[issue1367] mkdir+chdir problem in multiple threads

2007-10-31 Thread Jean-Paul Calderone
Jean-Paul Calderone added the comment: This isn't a bug in Python. Working directory, which os.chdir modifies, is process-global. One of your threads makes a directory, then gets suspended while another one makes a different directory and changes into it, then the first tries to change

logic programming in python (was something about py3k)

2007-10-30 Thread Jean-Paul Calderone
On Tue, 30 Oct 2007 14:09:39 -, Steven D'Aprano [EMAIL PROTECTED] wrote: [snip] (Aside: I think it a shame that there is one major paradigm that Python doesn't have *any* support for at all: logic programming, like Prolog. I don't quite know what it is good for, but I'd like to find out!)

Re: A Python 3000 Question

2007-10-30 Thread Jean-Paul Calderone
On Tue, 30 Oct 2007 15:25:54 GMT, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-10-30, Eduardo O. Padoan [EMAIL PROTECTED] wrote: This is a FAQ: http://effbot.org/pyfaq/why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list.htm Holy Airy

Re: Is there a usenet library for Python?

2007-10-30 Thread Jean-Paul Calderone
On Tue, 30 Oct 2007 22:25:28 GMT, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Is there a Python library to communicate with a usenet server? I did a bit of googling and found some sites that suggest that you can roll your own fairly easily but, mostly, I got a lot of

Re: Built-in functions and keyword arguments

2007-10-29 Thread Jean-Paul Calderone
On Mon, 29 Oct 2007 19:03:34 +0200, Hendrik van Rooyen [EMAIL PROTECTED] wrote: Tim Chase [EMAIL PROTECTED] I think you are being a little bit unfair here: help(len) says: len(...) len(object) - integer Return the number of items of a sequence or mapping. which implies

Re: Adding idle timeout capabilities to asyncore

2007-10-25 Thread Jean-Paul Calderone
On Thu, 25 Oct 2007 04:46:12 -, Josiah Carlson [EMAIL PROTECTED] wrote: [snip] But really, since I already wrote code that handles *all* of the timeout handling with a *single* time.time() call, and that also generally minimizes all explicit function calls, I'm not sure that your testing

Re: Parallel insert to postgresql with thread

2007-10-25 Thread Jean-Paul Calderone
On Thu, 25 Oct 2007 04:00:44 -0700, Abandoned [EMAIL PROTECTED] wrote: Hi.. I use the threading module for the fast operation. For fast operation, avoid the threading module. Here's a code sample: conn = connect(...) cursor = conn.cursor() cursor.executemany(INSERT INTO keywords

Re: Parallel insert to postgresql with thread

2007-10-25 Thread Jean-Paul Calderone
On Thu, 25 Oct 2007 09:46:54 -0500, Erik Jones [EMAIL PROTECTED] wrote: [snip] Fortunately, in his case, that's not necessarily true. If they do all their work with the same connection then, yes, but there are other problems with that as mention wrt thread safety and psycopg2. If he goes the

[issue1325] zipimport.zipimporter.archive undocumented and untested

2007-10-25 Thread Jean-Paul Calderone
New submission from Jean-Paul Calderone: zipimporter instances have a read-only archive attribute, but there is no documentation referring to it, nor any test coverage for its existence. It's quite useful to know what a zipimporter is pointed at (for debugging and other introspection). It'd

[issue1326] internal zipimport.zipimporter feature untested

2007-10-25 Thread Jean-Paul Calderone
New submission from Jean-Paul Calderone: It's possible to construct a zipimporter with a path which points first to a zip file and then continues to refer to a file within that zip file. For example, /foo/bar.zip/baz where /foo/bar.zip is not a directory, but a zip file, and baz is a file

[issue1325] zipimport.zipimporter.archive undocumented and untested

2007-10-25 Thread Jean-Paul Calderone
Changes by Jean-Paul Calderone: -- nosy: +fijal __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1325 __ ___ Python-bugs-list mailing list Unsubscribe: http

[issue1326] internal zipimport.zipimporter feature untested

2007-10-25 Thread Jean-Paul Calderone
Changes by Jean-Paul Calderone: -- nosy: +fijal __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1326 __ ___ Python-bugs-list mailing list Unsubscribe: http

[issue805194] Inappropriate error received using socket timeout

2007-10-25 Thread Jean-Paul Calderone
Jean-Paul Calderone added the comment: The APR comment is indeed correct, so this is probably a Python bug. -- nosy: +exarkun Tracker [EMAIL PROTECTED] http://bugs.python.org/issue805194

Re: Socket communication problem

2007-10-24 Thread Jean-Paul Calderone
On Wed, 24 Oct 2007 20:42:49 +0100, Sandy Dunlop [EMAIL PROTECTED] wrote: Hi, I'm new here, and fairly new to Python. I have been playing around with Python and started having a look at socket IO. I have written a script that communicates over a network to a server which is written in C. While

Re: Easiest way to get exit code from os.popen()?

2007-10-24 Thread Jean-Paul Calderone
On Wed, 24 Oct 2007 19:07:44 -, mrstephengross [EMAIL PROTECTED] wrote: Hi folks. I'm using os.popen() to run a command; according to the documentation, the filehandle.close() oepration is suppsoed to return the exit code. However, when I execute something like exit 5, close() returns 1280.

Re: pure python data compression (zip)

2007-10-23 Thread Jean-Paul Calderone
On Tue, 23 Oct 2007 14:47:40 +0200, Rene Maurer [EMAIL PROTECTED] wrote: Hallo I wonder if there are any pure python implementations available/known for the zip (or any other) data compression... As far as I know python's zlib uses http://www.zlib.net/, which is written in C. Unfortunately this

Re: Adding idle timeout capabilities to asyncore

2007-10-23 Thread Jean-Paul Calderone
On Tue, 23 Oct 2007 15:34:19 -, Josiah Carlson [EMAIL PROTECTED] wrote: [snip] Calling time.time() is relatively inexpensive in comparison to pure Python function calls, but indeed, it could be a bottleneck. Did you benchmark this on some system? There isn't really any pure Python function

Re: python with braces pre-processor

2007-10-22 Thread Jean-Paul Calderone
On Mon, 22 Oct 2007 09:44:27 + (UTC), Paul Brauner [EMAIL PROTECTED] wrote: [snip] I thought that it must exists because everyone generating python code will encounter more or less the same problem, but I didn't find any 'official' thing on the subject. I expect many projects which emit

Re: Get the instance name from a list by Reflection

2007-10-20 Thread Jean-Paul Calderone
On Sat, 20 Oct 2007 21:10:34 +0200 (CEST), sccs cscs [EMAIL PROTECTED] wrote: Hello, I cannot find into documentation how to get the instance name. I found the attributes __dict__,__class__ ,__bases__ __name__ , but if i have the code: class A :pass a1 = A () a2 = A () aList = [a1,a2] for elem

Re: Automatically organize module imports

2007-10-15 Thread Jean-Paul Calderone
On Mon, 15 Oct 2007 20:52:11 +0200, Thomas Wittek [EMAIL PROTECTED] wrote: Hi! Is there any possibility/tool to automatically organize the imports at the beginning of a module? I don't mean automatic imports like autoimp does as I like seeing where my objects/functions really come from. For the

Re: Error on base64.b64decode() ?!

2007-10-12 Thread Jean-Paul Calderone
On Fri, 12 Oct 2007 14:59:13 -, Christoph Krammer [EMAIL PROTECTED] wrote: Hello everybody, I am using a python script to extract images from email messages. This works fine for some messages, but not all attached images can be decoded. I use the following code to decode the image and save it

Re: PEP idea: Instrumented Python

2007-10-12 Thread Jean-Paul Calderone
On Fri, 12 Oct 2007 11:33:11 -0500, Erik Jones [EMAIL PROTECTED] wrote: [snip] This got me thinking about building a module that could be included by projects that creates a socket and responds to messages on that socket in a separate thread from the main app so that you can connect to the app

Re: unpickle from URL problem

2007-10-10 Thread Jean-Paul Calderone
On Wed, 10 Oct 2007 05:58:51 GMT, Alan Isaac [EMAIL PROTECTED] wrote: I am on a Windows box. I pickle a tuple of 2 simple objects with the pickle module. It pickles fine. It unpickles fine. I upload to a server. I try to unpickle from the URL. No luck. Try it: x1, x2 =

Re: Python + Shoutpy + Twisted Locks

2007-10-09 Thread Jean-Paul Calderone
On Mon, 08 Oct 2007 23:00:46 GMT, John Nagle [EMAIL PROTECTED] wrote: Chris Mellon wrote: On 10/7/07, Michel Albert [EMAIL PROTECTED] wrote: On Oct 6, 4:21 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Fri, 05 Oct 2007 04:55:55 -0300, exhuma.twn [EMAIL PROTECTED] escribi?: [...] What I

Re: Native class methods

2007-10-09 Thread Jean-Paul Calderone
On 09 Oct 2007 17:45:12 +0200, Stefan Arentz [EMAIL PROTECTED] wrote: Chris Mellon [EMAIL PROTECTED] writes: On 09 Oct 2007 17:20:09 +0200, Stefan Arentz [EMAIL PROTECTED] wrote: Is there an easy way to implement a specific method of a Python class in C? Like a native method in Java? I

Re: Python 3.0 migration plans?

2007-09-28 Thread Jean-Paul Calderone
On Fri, 28 Sep 2007 11:04:39 -0700, TheFlyingDutchman [EMAIL PROTECTED] wrote: [snip] In this case I asked it as part of the original question and it was ignored. I have programmed in C and C++ and a little Pascal many years ago. I don't remember anything about Higher Order Functions and would

Re: Parameterize formatting string

2007-09-21 Thread Jean-Paul Calderone
On Fri, 21 Sep 2007 20:16:29 +0200, David [EMAIL PROTECTED] wrote: On 9/21/07, cyril giraudon [EMAIL PROTECTED] wrote: Hello, I 'd like to know if a std::setw() equivalent function exists in python ? i thought of something like : a = 16 %ai % 12 But it is not correct. Any Idea ? (%i

[issue1147] string exceptions inconsistently deprecated/disabled

2007-09-11 Thread Jean-Paul Calderone
New submission from Jean-Paul Calderone: Python 2.5 deprecated raising string exceptions. It also added the throw method to generator objects which can be used to raise an exception, including a string exception. Raising an exception with this method doesn't issue a deprecation warning

Re: Python is overtaking Perl

2007-09-04 Thread Jean-Paul Calderone
On Tue, 04 Sep 2007 00:32:23 -, Ben [EMAIL PROTECTED] wrote: Here are the statistics from Google Trends: http://benyang22a.blogspot.com/2007/09/perl-vs-python.html From the graph, it seems more accurate to say that Perl is undertaking Python. Jean-Paul --

[issue1598083] Top-level exception handler writes to stdout unsafely

2007-08-28 Thread Jean-Paul Calderone
Jean-Paul Calderone added the comment: Not likely, given the number of things on my plate already. _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1598083 _ ___ Python

Re: My 'time' module is broken, unsure of cause

2007-08-23 Thread Jean-Paul Calderone
On Thu, 23 Aug 2007 11:22:55 -0600, darren kirby [EMAIL PROTECTED] wrote: Hi all, I have a strange error here and I am unsure how to further investigate it: Python 2.4.4 (#1, Aug 23 2007, 10:51:29) [GCC 4.1.2 (Gentoo 4.1.2)] on linux2 Type help, copyright, credits or license for more

Re: Fast socket write

2007-08-22 Thread Jean-Paul Calderone
On Wed, 22 Aug 2007 13:01:47 -, Greg Copeland [EMAIL PROTECTED] wrote: On Aug 21, 9:40 pm, Bikal KC [EMAIL PROTECTED] wrote: Greg Copeland wrote: I'm having a brain cramp right now. I can't see to recall the name of Is your cramp gone now ? :P I wish. If anyone can remember the name

Re: curses library

2007-08-14 Thread Jean-Paul Calderone
On Tue, 14 Aug 2007 21:45:51 +0300, Ghirai [EMAIL PROTECTED] wrote: On Tue, 14 Aug 2007 18:27:16 GMT Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-08-14, Ghirai [EMAIL PROTECTED] wrote: I need to write a console application. Are there any wrappers around curses/ncurses? Or any other

Re: The Future of Python Threading

2007-08-10 Thread Jean-Paul Calderone
On Fri, 10 Aug 2007 10:01:51 -, Justin T. [EMAIL PROTECTED] wrote: Hello, While I don't pretend to be an authority on the subject, a few days of research has lead me to believe that a discussion needs to be started (or continued) on the state and direction of multi-threading python. [snip -

Re: The Future of Python Threading

2007-08-10 Thread Jean-Paul Calderone
On Fri, 10 Aug 2007 16:37:19 -, Justin T. [EMAIL PROTECTED] wrote: On Aug 10, 3:52 am, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On Fri, 10 Aug 2007 10:01:51 -, Justin T. [EMAIL PROTECTED] wrote: Hello, While I don't pretend to be an authority on the subject, a few days of research

Re: Stackless Integration

2007-08-09 Thread Jean-Paul Calderone
On Thu, 09 Aug 2007 09:00:27 -, Justin T. [EMAIL PROTECTED] wrote: Hi, I've been looking at stackless python a little bit, and it's awesome. My question is, why hasn't it been integrated into the upstream python tree? Does it cause problems with the current C-extensions? It seems like if

Re: Stackless Integration

2007-08-09 Thread Jean-Paul Calderone
On Thu, 9 Aug 2007 05:05:31 -0700, Michael Bentley [EMAIL PROTECTED] wrote: On Aug 9, 2007, at 4:48 AM, Jean-Paul Calderone wrote: On Thu, 09 Aug 2007 09:00:27 -, Justin T. [EMAIL PROTECTED] wrote: Hi, I've been looking at stackless python a little bit, and it's awesome. My question

Re: Importing * From a Package

2007-08-06 Thread Jean-Paul Calderone
On Mon, 6 Aug 2007 10:06:51 -0400, Patrick Doyle [EMAIL PROTECTED] wrote: Reading through the Python tutorial, I got to section 6.4.1, Importing * From a Package, which states: If __all__ is not defined, the statement from Sound.Effects import * does not import all submodules from the package

Re: udp, datagram sockets

2007-08-06 Thread Jean-Paul Calderone
On Mon, 06 Aug 2007 09:03:45 -0700, 7stud [EMAIL PROTECTED] wrote: I'm trying to understand datagrams. My client program sends a message to the server, and then the server infinitely loops over the recv() to make sure all the data was received. I'm trying to use an * to signal the end of the

Re: python 3.0, pywin32 and scipy

2007-08-02 Thread Jean-Paul Calderone
On Thu, 02 Aug 2007 21:16:04 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: vml schrieb: Hello, I am trying to promote python in my job, my collegue only see matlab and microsoft scripting language. I understood that there willl be no backward compatibility between python 2.x and 3.0,

Re: python 3.0, pywin32 and scipy

2007-08-02 Thread Jean-Paul Calderone
On Thu, 02 Aug 2007 23:07:12 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: Jean-Paul Calderone schrieb: On Thu, 02 Aug 2007 21:16:04 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: vml schrieb: Hello, I am trying to promote python in my job, my collegue only see matlab and microsoft

Re: interaction of 'with' and 'yield'

2007-07-31 Thread Jean-Paul Calderone
On Tue, 31 Jul 2007 07:34:09 -0400, Neal Becker [EMAIL PROTECTED] wrote: I'm wondering if a generator that is within a 'with' scope exits the 'with' when it encounters 'yield'. I would like to use a generator to implement RAII without having to syntactically enclose the code in the 'with' scope,

Re: Detecting __future__ features

2007-07-30 Thread Jean-Paul Calderone
On Mon, 30 Jul 2007 15:48:00 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: Neil Cerutti wrote: On 2007-07-30, André [EMAIL PROTECTED] wrote: On Jul 30, 9:39 am, Neil Cerutti [EMAIL PROTECTED] wrote: I don't understand the qualification, at runtime, you're making. What's wrong with just

Re: File handle not being released by close

2007-07-30 Thread Jean-Paul Calderone
On Mon, 30 Jul 2007 07:36:00 -0700, [EMAIL PROTECTED] wrote: Hi, [snip] f=open(fileBeginning+.tmp, 'w') f.write(Hello) f.close You forgot to call close. Try this final line, instead: f.close() Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: split on NO-BREAK SPACE

2007-07-22 Thread Jean-Paul Calderone
On Sun, 22 Jul 2007 21:13:02 +0200, Peter Kleiweg [EMAIL PROTECTED] wrote: Carsten Haese schreef op de 22e dag van de hooimaand van het jaar 2007: On Sun, 2007-07-22 at 17:44 +0200, Peter Kleiweg wrote: It's a feature. See help(str.split): If sep is not specified or is None, any whitespace

Re: subprocess (spawned by os.system) inherits open TCP/UDP/IP port

2007-07-20 Thread Jean-Paul Calderone
On Thu, 19 Jul 2007 21:07:55 -0500, alf [EMAIL PROTECTED] wrote: Hi, I need a help with explaining following behavior. Although it is not python issue per say, python helped me to write sample programs and originally I encountered the issue using python software. So let's assume we have two

Re: Pickled objects over the network

2007-07-20 Thread Jean-Paul Calderone
On Fri, 20 Jul 2007 09:32:17 +0200, Hendrik van Rooyen [EMAIL PROTECTED] wrote: Walker Lindley wrote: Right, I could use Pyro, but I don't need RPC, I just wanted an easy way to send objects across the network. I'm sure both Pyro and Yami can do that and I may end up using one of them. For the

Re: subprocess (spawned by os.system) inherits open TCP/UDP/IP port

2007-07-20 Thread Jean-Paul Calderone
On Fri, 20 Jul 2007 08:15:39 -0500, alf [EMAIL PROTECTED] wrote: Jean-Paul Calderone wrote: You can avoid this, if you like. Set FD_CLOEXEC on the socket after you open it, before you call os.system: old = fcntl.fcntl(s.fileno(), fcntl.F_GETFD) fcntl.fcntl(s.fileno(), fcntl.F_SETFD, old

Re: Pickled objects over the network

2007-07-20 Thread Jean-Paul Calderone
On Fri, 20 Jul 2007 08:27:13 -0700, Walker Lindley [EMAIL PROTECTED] wrote: It doesn't interface well because the string you end up with often doesn't fit into a single packet. Therefore you have to add a layer of protocol on top of it that allows you to check to make sure you have the whole

Re: Sorting dict keys

2007-07-20 Thread Jean-Paul Calderone
On Fri, 20 Jul 2007 15:27:51 -0700, [EMAIL PROTECTED] wrote: Consider the following: a = {1:2, 3:4, 2:5} Say that i want to get the keys of a, sorted. First thing I tried: b = a.keys().sort() print b None Doesn't work. Probably because I am actually trying to sort the keys of the dictionary

Re: UDP broadcast over a specific interface

2007-07-19 Thread Jean-Paul Calderone
On Thu, 19 Jul 2007 12:32:02 -, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I am trying to send UDP broadcast packets over a specific interface and I am having trouble specifying the interface: host='192.168.28.255' sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(('',0))

Re: How do you debug when a unittest.TestCase fails?

2007-07-19 Thread Jean-Paul Calderone
On Thu, 19 Jul 2007 09:25:50 -0400, Emin.shopper Martinian.shopper [EMAIL PROTECTED] wrote: After poking around the unittest source code, the best solution I could come up with was to do import unittest; unittest.TestCase.run = lambda self,*args,**kw: unittest.TestCase.debug(self) before running

Re: Pickled objects over the network

2007-07-18 Thread Jean-Paul Calderone
On Tue, 17 Jul 2007 14:57:16 -0700, Walker Lindley [EMAIL PROTECTED] wrote: I'm working on a distributed computing program and need to send Python objects over a TCP socket. Specifically, the objects that I'm working with subclass the builtin list type (I don't know whether or not that matters),

Re: How do you debug when a unittest.TestCase fails?

2007-07-18 Thread Jean-Paul Calderone
On Wed, 18 Jul 2007 16:40:46 -0400, Emin.shopper Martinian.shopper [EMAIL PROTECTED] wrote: Dear Experts, How do you use pdb to debug when a TestCase object from the unittest module fails? Basically, I'd like to run my unit tests and invoke pdb.pm when something fails. I tried the following

Re: variable naming query

2007-07-12 Thread Jean-Paul Calderone
On Thu, 12 Jul 2007 10:33:03 -, loial [EMAIL PROTECTED] wrote: I'ma a newbie python user and would like clarification on variable naming conventions. What is the difference between self.myvariable This is the convention for public attributes. self._myvariable This is the convention for

Re: Python IRC bot using Twisted

2007-07-11 Thread Jean-Paul Calderone
On Wed, 11 Jul 2007 03:51:27 -0700, ddtm [EMAIL PROTECTED] wrote: I have another problem with my IRC bot. There is privmsg(self, user, channel, msg) function (this function handles the incoming IRC data) in the code that was mentioned above. I have a special condition in this function that if a

Re: Best architecture for proxy?

2007-07-11 Thread Jean-Paul Calderone
On Wed, 11 Jul 2007 07:00:18 -0700, Andrew Warkentin [EMAIL PROTECTED] wrote: On Jul 10, 8:19 pm, Steve Holden [EMAIL PROTECTED] wrote: Bjoern Schliessmann wrote: Andrew Warkentin wrote: I am going to write a general-purpose modular proxy in Python. It will consist of a simple core and

Re: Per thread data

2007-07-09 Thread Jean-Paul Calderone
On Mon, 09 Jul 2007 13:57:02 +0100, Will McGugan [EMAIL PROTECTED] wrote: Hi, Is there a canonical way of storing per-thread data in Python? See threading.local: http://python.org/doc/lib/module-threading.html Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: In search of python idiom for accessing arbitrary fields at run time

2007-07-08 Thread Jean-Paul Calderone
On Sun, 08 Jul 2007 18:21:41 -, mshiltonj [EMAIL PROTECTED] wrote: I'm trying to find the preferred python idiom for access arbitrary fields of objects at run time. It's not an idiom, it's a built-in function: getattr. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Expandable 2D Dictionaries?

2007-07-06 Thread Jean-Paul Calderone
On Fri, 06 Jul 2007 15:43:55 -, Robert Dailey [EMAIL PROTECTED] wrote: Hi, I am interested in creating an expandable (dynamic) 2D dictionary. For example: myvar[cat][paw] = Some String The above example assumes myvar is declared. In order for this to work, I have to know ahead of time the

Re: SMTP server w/o using Twisted framework

2007-07-05 Thread Jean-Paul Calderone
On Thu, 05 Jul 2007 18:56:49 -, _spitFIRE [EMAIL PROTECTED] wrote: On Jul 5, 1:34 pm, Jeff McNeil [EMAIL PROTECTED] wrote: If you just want to send mail, you should be able to use the standard smtplib module (http://docs.python.org/lib/module-smtplib.html). If your recipients are on the

Re: Python IRC bot using Twisted

2007-07-03 Thread Jean-Paul Calderone
On Tue, 03 Jul 2007 09:46:59 -, ddtm [EMAIL PROTECTED] wrote: I'm using an example of IRC bot (_ttp://twistedmatrix.com/projects/ words/documentation/examples/ircLogBot.py) to create my own bot. But I have a problem. I'm trying to make my bot send messages periodically. But I can't find a way

Re: Debugging broken pipe (in telnetlib)

2007-07-03 Thread Jean-Paul Calderone
On Tue, 03 Jul 2007 05:12:22 -0700, Samuel [EMAIL PROTECTED] wrote: Hi, When using telnetlib, the connection sometimes breaks with the following error: error: (32, 'Broken pipe') where the traceback points to self.sock.send(buffer) in telnetlib.py. The problem is unreproducible, but happens

Re: what is wrong with that r\

2007-07-03 Thread Jean-Paul Calderone
On Tue, 03 Jul 2007 06:16:43 -0700, [EMAIL PROTECTED] wrote: On Jul 3, 7:15 am, alf [EMAIL PROTECTED] wrote: question without words: r\ File stdin, line 1 r\ ^ SyntaxError: EOL while scanning single-quoted string r\ '\\ ' One slash escapes the following character, so

Re: Python IRC bot using Twisted

2007-07-03 Thread Jean-Paul Calderone
On Tue, 03 Jul 2007 13:44:34 -, ddtm [EMAIL PROTECTED] wrote: On 3, 16:01, Jean-Paul Calderone [EMAIL PROTECTED] wrote: [snip] Thank you very much! It's a very useful information. One more question: can I cancel the DelayedCall using its ID (it is returned from callLater(...)) from

Re: python 3.0 or 3000 ....is it worth waiting??? Newbie Question

2007-07-03 Thread Jean-Paul Calderone
On Tue, 03 Jul 2007 15:13:46 -, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi I'm considering learning Python...but with the python 3000 comming very soon, is it worth waiting for?? I know that the old style of coding python will run parallel with the new, but I mean, its going to come to an

Re: Python IRC bot using Twisted

2007-07-03 Thread Jean-Paul Calderone
On Tue, 03 Jul 2007 15:51:30 -, ddtm [EMAIL PROTECTED] wrote: On 3, 17:55, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On Tue, 03 Jul 2007 13:44:34 -, ddtm [EMAIL PROTECTED] wrote: On 3, 16:01, Jean-Paul Calderone [EMAIL PROTECTED] wrote: [snip] Thank you very much! It's

Re: Debugging broken pipe (in telnetlib)

2007-07-03 Thread Jean-Paul Calderone
On Tue, 03 Jul 2007 08:54:25 -0700, Samuel [EMAIL PROTECTED] wrote: On Jul 3, 3:03 pm, Jean-Paul Calderone [EMAIL PROTECTED] wrote: EPIPE results when writing to a socket for which writing has been shutdown. This most commonly occurs when the socket has closed. You need to handle

Re: Python compilation ??

2007-07-02 Thread Jean-Paul Calderone
On Mon, 02 Jul 2007 16:14:41 -0400, Steve Holden [EMAIL PROTECTED] wrote: Evan Klitzke wrote: On 7/2/07, Cathy Murphy [EMAIL PROTECTED] wrote: Is python a compiler language or interpreted language. If it is interpreter , then why do we have to compile it? It's an interpreted language. It is

Re: Python's only one way to do it philosophy isn't good?

2007-06-29 Thread Jean-Paul Calderone
On Fri, 29 Jun 2007 09:56:14 -0400, Douglas Alan [EMAIL PROTECTED] wrote: Chris Mellon [EMAIL PROTECTED] writes: You're arguing against explicit resource management with the argument that you don't need to manage resources. Can you not see how ridiculously circular this is? No. It is insane

Re: IMAP library

2007-06-28 Thread Jean-Paul Calderone
On Thu, 28 Jun 2007 18:44:02 -0300, Bruno Barberi Gnecco [EMAIL PROTECTED] wrote: It seems that this question has been asked a few times in this group before, but sometime has passed since the last post and maybe there's something new. I'm looking for a high level IMAP library--I know of

Re: PyKQueue

2007-06-27 Thread Jean-Paul Calderone
On Tue, 26 Jun 2007 21:48:46 -0700, Adam Atlas [EMAIL PROTECTED] wrote: Does anyone have a copy of PyKQueue 2.0 around? The site it's supposed to be on (http://python-hpio.net/trac/wiki/PyKQueue) is down. -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-blocking keyboard read

2007-06-26 Thread Jean-Paul Calderone
On Tue, 26 Jun 2007 22:37:16 +0200, Laszlo Nagy [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I am writing a curses application, but the getch() does not seem to give me all I want. Of course, if I press d, it returns an ord(d) and so on. But I want to be able to detect whether alt, shift

Re: Do eval() and exec not accept a function definition? (like 'def foo: pass) ?

2007-06-23 Thread Jean-Paul Calderone
On Sun, 24 Jun 2007 11:17:40 +1000, Steven D'Aprano [EMAIL PROTECTED] wrote: On Sat, 23 Jun 2007 19:58:32 +, vasudevram wrote: Hi group, Question: Do eval() and exec not accept a function definition? (like 'def foo: pass) ? eval() is a function, and it only evaluates EXPRESSIONS, not

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

Re: Conceptualizing Threading

2007-06-21 Thread Jean-Paul Calderone
On Thu, 21 Jun 2007 08:03:22 -0700, JonathanB [EMAIL PROTECTED] wrote: You described how threads introduce a problem in your program -- that of generating a sequence of sequential identifiers -- but you didn't describe the problem that threads are solving in your program. Maybe you don't

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 tests in

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 general.

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 someone has some serious

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): ... print

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)

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,

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

Re: NEWBIE: Extending a For Statement.

2007-05-21 Thread Jean-Paul Calderone
On 21 May 2007 05:10:46 -0700, mosscliffe [EMAIL PROTECTED] wrote: I keep seeing examples of statements where it seems conditionals are appended to a for statement, but I do not understand them. I would like to use one in the following scenario. I have a dictionary of mydict = { 1: 500, 2:700,

Re: howto check does module 'asdf' exist? (is available for import)

2007-05-21 Thread Jean-Paul Calderone
On 21 May 2007 06:17:16 -0700, dmitrey [EMAIL PROTECTED] wrote: howto check does module 'asdf' exist (is available for import) or no? (without try/cache of course) Thx in advance, D. You could use twisted.python.modules: $ python Python 2.4.3 (#2, Oct 6 2006, 07:52:30) [GCC 4.0.3

Re: Moving class used in pickle

2007-05-15 Thread Jean-Paul Calderone
On Tue, 15 May 2007 13:23:29 -0600, Jeffrey Barish [EMAIL PROTECTED] wrote: I have a class derived from string that is used in a pickle. In the new version of my program, I moved the module containing the definition of the class. Now the unpickle fails because it doesn't find the module. I was

Re: Thread-safe dictionary

2007-05-10 Thread Jean-Paul Calderone
On 10 May 2007 05:45:24 -0700, [EMAIL PROTECTED] wrote: Hi, please consider the following code: from __future__ import with_statement class safe_dict(dict): def __init__(self, *args, **kw): self.lock = threading.Lock() dict.__init__(self, *args, **kw) def

Re: Setting up python socket server with non-standard termination string.

2007-05-08 Thread Jean-Paul Calderone
On 8 May 2007 06:59:26 -0700, [EMAIL PROTECTED] wrote: Hi, I'm trying to create a tcp/ip port listening socket server for various cellular devices that don't use the standard \r\n termination string at the end of their message. Instead, they use -ND-. Do you know how I can setup such a server,

Re: Non blocking sockets with select.poll() ?

2007-05-05 Thread Jean-Paul Calderone
On Sat, 5 May 2007 15:37:31 +0300, Maxim Veksler [EMAIL PROTECTED] wrote: On 5/4/07, Jean-Paul Calderone [EMAIL PROTECTED] wrote: #!/usr/bin/env python import socket import select class PollingSocket(socket.socket): Usually there's no particularly good reason to subclass socket

Re: Non blocking sockets with select.poll() ?

2007-05-04 Thread Jean-Paul Calderone
On Fri, 4 May 2007 15:05:46 +0300, Maxim Veksler [EMAIL PROTECTED] wrote: On 5/4/07, Maxim Veksler [EMAIL PROTECTED] wrote: On 5/4/07, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On Fri, 4 May 2007 13:04:41 +0300, Maxim Veksler [EMAIL PROTECTED] wrote: Hi, I'm trying to write a non

Re: Non blocking sockets with select.poll() ?

2007-05-04 Thread Jean-Paul Calderone
On Fri, 4 May 2007 13:04:41 +0300, Maxim Veksler [EMAIL PROTECTED] wrote: Hi, I'm trying to write a non blocking socket port listener based on poll() because select is limited to 1024 fd. Here is the code, it never gets to I did not block until I do a telnet connection to port 1. What were

Re: ascii to unicode line endings

2007-05-03 Thread Jean-Paul Calderone
On 3 May 2007 04:30:37 -0700, [EMAIL PROTECTED] wrote: On 2 May, 17:29, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On 2 May 2007 09:19:25 -0700, [EMAIL PROTECTED] wrote: The code: import codecs udlASCII = file(c:\\temp\\CSVDB.udl,'r') udlUNI = codecs.open(c:\\temp\\CSVDB2.udl,'w

Re: Microsoft's Dynamic Languages Runtime (DLR)

2007-05-03 Thread Jean-Paul Calderone
On 3 May 2007 12:13:49 GMT, Duncan Booth [EMAIL PROTECTED] wrote: sturlamolden [EMAIL PROTECTED] wrote: I am curious to know how it performs in comparison to CPython and an efficient compiled Lisp like CMUCL. Speed is a major problem with CPython but not with .NET or CMUCL, so it will be

Re: ascii to unicode line endings

2007-05-02 Thread Jean-Paul Calderone
On 2 May 2007 09:19:25 -0700, [EMAIL PROTECTED] wrote: The code: import codecs udlASCII = file(c:\\temp\\CSVDB.udl,'r') udlUNI = codecs.open(c:\\temp\\CSVDB2.udl,'w',utf_16) udlUNI.write(udlASCII.read()) udlUNI.close() udlASCII.close() This doesn't seem to generate the correct line endings.

Re: I wish that [].append(x) returned [x]

2007-05-02 Thread Jean-Paul Calderone
On Wed, 02 May 2007 13:05:08 -0700, Tobiah [EMAIL PROTECTED] wrote: In addition to the above good advice, in case you are submitting a query to a DB-API compliant SQL database, you should use query parameters instead of building the query with string substitution. I tried that a long time

Re: My python annoyances so far

2007-04-26 Thread Jean-Paul Calderone
On 26 Apr 2007 20:05:45 +0200, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-04-26, Steven Howe [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Well, why do some things in the library have to be functions, and other things have to be class methods? Perhaps because some things are more

<    3   4   5   6   7   8   9   10   11   >