Re: python+ncurses: I can't display accents

2007-01-27 Thread Carsten Haese
On 27 Jan 2007 07:43:59 GMT, Fabrice DELENTE wrote > Incidentally, I noticed something about the environment: in my > script, I use the LINES and COLUMNS environment vars that are set in > my shell: > > columns=int(os.environ.get("COLUMNS")) > lines=int(os.environ.get("LINES")) > > In the shell

Re: Yank Bastards KILLED THEIR OWN PEOPLE to stage 911 DRAMA

2007-01-27 Thread bryan rasmussen
See, if the python list mail server was written in Lisp Paul Graham would already have been able to write up a spam filter to ban this guy. Seriously though, shouldn't Thermate be banned by now. Cheers, Bryan Rasmussen On 26 Jan 2007 10:56:44 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Re: python+ncurses: I can't display accents

2007-01-27 Thread Fabrice DELENTE
> Try "export LINES COLUMNS" to set them as environment variables. Thanks, it works. Didn't know that. -- Fabrice DELENTE -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert String to list of chars

2007-01-27 Thread Vlad Dogaru
On Jan 27, 9:18 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-01-27, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > How can I convert a string to a char list? > > for example > > > "hello" --> ['h','e','l','l','o'] > > > I have been searching but I can't find my answers > list("hello")

Re: python+ncurses: I can't display accents

2007-01-27 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Fabrice DELENTE wrote: > As support for 8-bit (and even unicode) is important for my script, is there > any hope? Should I switch to slang instead of curses? Take a look at urwid: http://excess.org/urwid/ Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.or

Re: wx Python event question

2007-01-27 Thread Steve
use wx.Timer - you bind a method to a timer event and define the timer's interval when you start it timer = wx.Timer(self, -1) self.Bind(wx.EVT_TIMER, self.timerMethod, timer) timer.Start(500) On Jan 27, 5:56 pm, "dudds" <[EMAIL PROTECTED]> wrote: > Hi I really haven't used wxPython before and I

Re: The reliability of python threads

2007-01-27 Thread Hendrik van Rooyen
"Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: > Hendrik van Rooyen wrote: > > "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: 8< --- > > > Yea, I do some of that too. I use that with conditional print > statements to stderr when i'm doing

New vs Old Style Python Classes in C Extensions?

2007-01-27 Thread Jeff Rush
While I have a reasonable understanding of the differences in new-style versus old-style classes, tonight while working a C extension module I realized I don't know how to indicate which style my C extension module should appear as. I'm following the Python docs for extended modules, but it does

extracting from web pages but got disordered words sometimes

2007-01-27 Thread Frank Potter
There are ten web pages I want to deal with. from http://www.af.shejis.com/new_lw/html/125926.shtml to http://www.af.shejis.com/new_lw/html/125936.shtml Each of them uses the charset of Chinese "gb2312", and firefox displays all of them in the right form, that's readable Chinese. My job is,

Re: Fixed length lists from .split()?

2007-01-27 Thread bearophileHUGS
Duncan Booth: > def nsplit(s, sep, n): > return (s.split(sep) + [""]*n)[:n] Another version, longer: from itertools import repeat def nsplit(text, sep, n): """ >>> nsplit("bcsn; 101; 1456", ";", 3) ['bcsn', ' 101', ' 1456'] >>> nsplit("bcsn; 101", ";", 3) ['bc

Re: New vs Old Style Python Classes in C Extensions?

2007-01-27 Thread Martin v. Löwis
Jeff Rush schrieb: > from cextension import Context > > class MyContext(Context): > > def __init__(self): > super(Context, self).__init__() > > repeatedly and reliably failed with a corrupted C data structure, while > this: > > class MyContext(Context): > > def __init__(self):

Re: python+ncurses: I can't display accents

2007-01-27 Thread Fabrice DELENTE
It's solved, it was a locale problem: I put import locale locale.setlocale(locale.LC_ALL,"fr_FR.iso8859-1") at the beginning of the script, and now the 8-bit-chars show up correctly. Thanks all for your help. -- Fabrice DELENTE -- http://mail.python.org/mailman/listinfo/python-list

Re: New vs Old Style Python Classes in C Extensions?

2007-01-27 Thread Carl Banks
On Jan 27, 6:11 am, Jeff Rush <[EMAIL PROTECTED]> wrote: > While I have a reasonable understanding of the differences in new-style versus > old-style classes, tonight while working a C extension module I realized I > don't know how to indicate which style my C extension module should appear as. > >

Re: assertions to validate function parameters

2007-01-27 Thread Nick Craig-Wood
Matthew Woodcraft <[EMAIL PROTECTED]> wrote: > I have a question for you. Consider this function: > > def f(n): > """Return the largest natural power of 2 which does not exceed n.""" > if n < 1: > raise ValueError > i = 1 > while i <= n: > j = i > i

Re: python+ncurses: I can't display accents

2007-01-27 Thread Thomas Dickey
Fabrice DELENTE <[EMAIL PROTECTED]> wrote: > My system is Linux, and the distribution is Slackware 10.1. > I have > /lib/libncurses.so.5.4 > /lib/libncursesw.so.5.4 > so I even have the wide-chars version available. Any hint on the python > configuration? I didn't find any function that would al

Hi, I'm new to python

2007-01-27 Thread millball54
Hey Everyone Let me tell you all a little bit about my programming background so you can get an idea of my capability, or lack of, dealing with p.l; so far i've learned some visual basic when i was doing my a-levels and thats about it lol. Basically i like the sound of python and its eas

Re: wx Python event question

2007-01-27 Thread dudds
Thanks Steve. On Jan 27, 8:01 pm, "Steve" <[EMAIL PROTECTED]> wrote: > use wx.Timer - you bind a method to a timer event and define the > timer's interval when you start it > > timer = wx.Timer(self, -1) > self.Bind(wx.EVT_TIMER, self.timerMethod, timer) > timer.Start(500) > > On Jan 27, 5:56 pm,

Re: assertions to validate function parameters

2007-01-27 Thread Carl Banks
On Jan 25, 11:26 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Note also that for real code, a bare assert like that is uselessly > uninformative: > > >>> x = 1 > >>> assert x == 3Traceback (most recent call last): > File "", line 1, in ? > AssertionError In real code, a traceback usually

Re: assertions to validate function parameters

2007-01-27 Thread Carl Banks
On Jan 25, 11:54 am, Matthew Wilson <[EMAIL PROTECTED]> wrote: > Lately, I've been writing functions like this: > > def f(a, b): > > assert a in [1, 2, 3] > assert b in [4, 5, 6] > > The point is that I'm checking the type and the values of the > parameters. > > I'm curious how this does

Re: problems with pyzeroconf and linux

2007-01-27 Thread Damjan
> I am trying to get pyzeroconf (http://sourceforge.net/projects/pyzeroconf) > running on my machine but having trouble... Running the Zeroconf.py file > seems to register the service, but is unable to find it. You should be running avahi.. it also comes python support. Here's an example that re

Commandline wrapper: help needed

2007-01-27 Thread Toby
I'm trying to write a simple commandline wrapper: a script that runs another program as a child and relays unbuffered stdin and stdout to/from the child process, possibly filtering it. The usefulness of such a program lies in the filtering stage, in a possible integration with readline, or in othe

Re: Hi, I'm new to python

2007-01-27 Thread Ravi Teja
On Jan 27, 5:37 am, [EMAIL PROTECTED] wrote: > Hey Everyone > > Let me tell you all a little bit about my programming background so > you can get an idea of my capability, or lack of, dealing with p.l; > so far i've learned some visual basic when i was doing my a-levels > and thats about it l

Dictionary inserts and threads

2007-01-27 Thread Martin P. Hellwig
Hi all, I'm thinking to speed up a process, I like to use multiple threads to get data fractions from multiple servers and place those data fragments into a local dictionary for further processing, the dictionary will look like this: self.dic = {'thread_a':dict(), 'thread_b':dict()

Re: how to remove c++ comments from a cpp file?

2007-01-27 Thread Toby
Frank Potter wrote: > r=re.compile(ur"//[^\r\n]+$", re.UNICODE|re.VERBOSE) > f_new=r.sub(ur"",f) >From the documentation: re.MULTILINE When specified [...] the pattern character "$" matches at the end of the string and at the end of each line (immediately preceding each ne

Re: Dictionary inserts and threads

2007-01-27 Thread Paul Rubin
"Martin P. Hellwig" <[EMAIL PROTECTED]> writes: > I assume that this is not a problem, but since assuming something > gives a lot of room for screw-ups I rather ask beforehand if I should > except all kinds of troubles when multiple threads update 'at the same > time' a dictionary or that I should

[ANN] ftputil 2.2.1

2007-01-27 Thread Stefan Schwarzer
ftputil 2.2.1 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.2 - This bugfix release checks and ignores status code 451 when FTPFiles are closed (thanks go to Alexander Holyapin). Upgrading is recommended. What is ftputil? -

ANN: Plex 1.1.5

2007-01-27 Thread greg
I have released a small update to Plex to fix the problem of assignment to None causing syntax warnings or errors in Python 2.3 and later. What is Plex? Plex is a Python module for lexical analysis that provides similar functionality to Lex and Flex. -- Greg -- http://mail.python.org/mailman/li

ANN: Pyrex 0.9.5

2007-01-27 Thread greg
Pyrex 0.9.5 is now available: http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ Warning Elimination Extensive changes have been made in this version in an effort to eliminate most of the C compiler warnings that used to occur when compiling with distutils. There are also numerous other en

IP address of webserver

2007-01-27 Thread Johny
How can I find server's IP address? >From console I can use ping, for example: C:\RobotP\cgi-bin>ping www.google.com Pinging www.google.com [209.85.129.147] with 32 bytes of data: Reply from 209.85.129.147: bytes=32 time=30ms TTL=244 Reply from 209.85.129.147: bytes=32 time=30ms TTL=244 .. .. So

distutils, sdist and tests

2007-01-27 Thread Steven Bethard
How do I get distutils to include my testing module in just the "sdist" distribution? My current call to setup() looks like:: distutils.core.setup( ... py_modules=['argparse'], ) If change this to:: distutils.core.setup( ... py_modules=['argpa

Re: IP address of webserver

2007-01-27 Thread Paul Rubin
"Johny" <[EMAIL PROTECTED]> writes: > So I know that www.google.com has 209.85.129.147 IP address. > But how can I find it directly from Python script? >>> import socket >>> print socket.gethostbyname('www.google.com') 66.102.7.147 >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: IP address of webserver

2007-01-27 Thread Gabriel Genellina
"Johny" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > How can I find server's IP address? >>From console I can use ping, for example: > > C:\RobotP\cgi-bin>ping www.google.com > Pinging www.google.com [209.85.129.147] with 32 bytes of data: > [...] > But how can I find it di

Re: extracting from web pages but got disordered words sometimes

2007-01-27 Thread Paul McGuire
On Jan 27, 5:18 am, "Frank Potter" <[EMAIL PROTECTED]> wrote: > There are ten web pages I want to deal with. > fromhttp://www.af.shejis.com/new_lw/html/125926.shtml > to http://www.af.shejis.com/new_lw/html/125936.shtml > > Each of them uses the charset of Chinese "gb2312", and firefox > displ

Re: extracting from web pages but got disordered words sometimes

2007-01-27 Thread Paul McGuire
After looking at the pyparsing results, I think I see the problem with your original code. You are selecting only the characters after the rightmost "-" character, but you really want to select everything to the right of "- -". In some of the titles, the encoded Chinese includes a "-" charac

Crunchy 0.8 release

2007-01-27 Thread André
Version 0.8 of Crunchy has been released. It is available on http://code.google.com/p/crunchy/ Crunchy, the Interactive Python Tutorial Maker, is an application that transforms an ordinary html-based Python tutorial into an interactive session within a web browser. Currently, only Firefox is sup

Re: distutils, sdist and tests

2007-01-27 Thread Robert Kern
Steven Bethard wrote: > How do I get distutils to include my testing module in just the "sdist" > distribution? Use a MANIFEST. http://docs.python.org/dist/source-dist.html > I want test_argparse.py to be available in the source distribution, but > I don't think it should be included in the

looking for ppp dialing tutorial / resources

2007-01-27 Thread hg
Hi, I need to implement ppp client connection in my program ... found chestnut dialer so far ... any other resource in mind ? Thanks hg -- http://mail.python.org/mailman/listinfo/python-list

Re: Hi, I'm new to python

2007-01-27 Thread Jerry
I would definitely suggest checking out the documentation at http:// www.python.org/doc/. Also, you can check out the free book Dive into Python at http://www.diveintopython.org. It provides a great overview starting at the very beginning. I found it great and hope to buy it soon to support t

Re: stop script w/o exiting interpreter

2007-01-27 Thread Alan Isaac
Please note that this post has subject "stop script w/o exiting interpreter". The object is to work at the *interactive* interpreter, without leaving it. Here is an example goal: start a Python shell, execfile a script, exit the script at line 25, and return to the Python shell. E.g., some langu

Re: assertions to validate function parameters

2007-01-27 Thread Steven D'Aprano
On Sat, 27 Jan 2007 06:58:04 -0800, Carl Banks wrote: >> I find that when I detect invalid parameters overtly, I spend less time >> debugging. > > If it helps go ahead an use them. The world won't end if you use an > assertion in a less than ideal situation. And, after all, if someone > doesn

Re: stop script w/o exiting interpreter

2007-01-27 Thread Gabriel Genellina
"Alan Isaac" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > Please note that this post has subject > "stop script w/o exiting interpreter". > Note that I can just put the undefined name ``stop`` on any line > I want, and the script will stop execucting at that line and will >

Re: Do I need Python to run Blender correctly?

2007-01-27 Thread AKA gray asphalt
"John Nagle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > AKA gray asphalt wrote: >> I downloaded Blender but there was no link for python. Am I on the right >> track? > >Blender doesn't require Python, but if you have Python, you can > write plug-ins for Blender. Get "The

Re: Do I need Python to run Blender correctly?

2007-01-27 Thread AKA gray asphalt
"John Nagle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > AKA gray asphalt wrote: >> I downloaded Blender but there was no link for python. Am I on the right >> track? > >Blender doesn't require Python, but if you have Python, you can > write plug-ins for Blender. Get "The

Re: Do I need Python to run Blender correctly?

2007-01-27 Thread John Nagle
AKA gray asphalt wrote: > "John Nagle" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>AKA gray asphalt wrote: >> >>>I downloaded Blender but there was no link for python. Am I on the right >>>track? >> >> Blender doesn't require Python, but if you have Python, you can >>writ

set update in 2.5

2007-01-27 Thread Duncan Smith
Hello, In moving from 2.4 to 2.5 I find that some of my unit tests are now failing. I've worked out that the problem relates to the set update method. In 2.4 I could update a set with an iterable type derived from dict as the argument. I now find that the set is updated with the hash values

Re: extracting from web pages but got disordered words sometimes

2007-01-27 Thread Frank Potter
Thank you, I tried again and I figured it out. That's something with beautiful soup, I worked with it a year ago also dealing with Chinese html pages and nothing error happened. I read the old code and I find the difference. Change the page to unicode before feeding to beautiful soup, then every

Re: distutils, sdist and tests

2007-01-27 Thread Steven Bethard
Robert Kern wrote: > Steven Bethard wrote: >> How do I get distutils to include my testing module in just the "sdist" >> distribution? > > Use a MANIFEST. > > http://docs.python.org/dist/source-dist.html > >> I want test_argparse.py to be available in the source distribution, but >> I don't

Re: distutils, sdist and tests

2007-01-27 Thread Robert Kern
Steven Bethard wrote: > Robert Kern wrote: >> Steven Bethard wrote: >>> How do I get distutils to include my testing module in just the "sdist" >>> distribution? >> Use a MANIFEST. >> >> http://docs.python.org/dist/source-dist.html Also, I just noted this tidbit: """If you don't supply an expl

Re: assertions to validate function parameters

2007-01-27 Thread Carl Banks
On Jan 27, 6:51 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 27 Jan 2007 06:58:04 -0800, Carl Banks wrote: > >> I find that when I detect invalid parameters overtly, I spend less time > >> debugging. > > > If it helps go ahead an use them. The world won't end if you use an > > asser

Re: assertions to validate function parameters

2007-01-27 Thread Steven D'Aprano
On Sat, 27 Jan 2007 19:29:06 -0800, Carl Banks wrote: > On Jan 27, 6:51 pm, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: >> On Sat, 27 Jan 2007 06:58:04 -0800, Carl Banks wrote: >> >> I find that when I detect invalid parameters overtly, I spend less time >> >> debugging. >> >> > If it helps go a

More Python screencasts (Google videos)

2007-01-27 Thread [EMAIL PROTECTED]
Here're three sample 3-6 min videos showing off Python to math teachers thinking about using a computer language instead of just calculators: http://controlroom.blogspot.com/2007/01/python-for-math-teachers.html Higher resolution versions are available to teachers enrolling in our program. Ki

log parser design question

2007-01-27 Thread avidfan
I need to parse a log file using python and I need some advice/wisdom on the best way to go about it: The log file entries will consist of something like this: ID=8688 IID=98889998 execute begin - 01.21.2007 status enabled locked working.lock status running status complet

ANN: Plex 1.1.5 (Repost)

2007-01-27 Thread greg
(Reposting to supply the URL that I forgot to include.:-() I have released a small update to Plex to fix the problem of assignment to None causing syntax warnings or errors in Python 2.3 and later. http://www.cosc.canterbury.ac.nz/greg.ewing/python/Plex What is Plex? Plex is a Python module for

Re: distutils, sdist and tests

2007-01-27 Thread Steven Bethard
Robert Kern wrote: > Steven Bethard wrote: >> Robert Kern wrote: >>> Steven Bethard wrote: How do I get distutils to include my testing module in just the "sdist" distribution? >>> Use a MANIFEST. >>> >>> http://docs.python.org/dist/source-dist.html > > Also, I just noted this tidbit:

Re: distutils, sdist and tests

2007-01-27 Thread Robert Kern
Steven Bethard wrote: > Robert Kern wrote: >> Are you sure that you don't have changes left over in your setup.py when you >> tested that? > > Yep. (Though I still cleared everything out and tried it again.) > Here's what I got using an unmodified setup.py and the MANIFEST.in you > suggested.

Re: distutils, sdist and tests

2007-01-27 Thread Steven Bethard
Robert Kern wrote: > Steven Bethard wrote: >> Robert Kern wrote: > >>> Are you sure that you don't have changes left over in your setup.py when you >>> tested that? >> Yep. (Though I still cleared everything out and tried it again.) >> Here's what I got using an unmodified setup.py and the MANIF

Re: distutils, sdist and tests

2007-01-27 Thread Steven Bethard
Robert Kern wrote: > Steven Bethard wrote: >> How do I get distutils to include my testing module in just the "sdist" >> distribution? > > Use a MANIFEST. Thanks again to Robert Kern for all the help. For the record, in the end all I did was add a MANIFEST.in file with the single line: i

Re: subclassing pyrex extension types in python

2007-01-27 Thread greg
Nitin wrote: > I am trying to subclass an extension type in Python and add attributes > to the new class but I keep getting errors. > > cdef class Spam: > > cdef int amount > > def __new__(self): > self.amount = 0 > > I get an error "TypeError: 'name2' is an > invalid keyword argument

import from future

2007-01-27 Thread lee
what are the things that we can do with import from future usage.i heard its very interesting..thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: import from future

2007-01-27 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, lee wrote: > what are the things that we can do with import from future usage.i > heard its very interesting..thanks Here's how to find out yourself (done with a 2.4 release): In [2]: import __future__ In [3]: dir(__future__) Out[3]: ['CO_FUTURE_DIVISION', 'CO_