Re: AttributeError: 'module' object has no attribute 'letters'

2008-02-11 Thread John Machin
On Feb 12, 9:24 am, black_13 <[EMAIL PROTECTED]> wrote: > what does this error mean? > i am trying to use mark hammonds win32 package. > > Traceback (most recent call last): > File "aui2.py", line 11, in > import win32com.client > File "C:\Python25\lib\site-packages\win32com\client\__init_

Re: mmap and shared memory

2008-02-11 Thread Tim Roberts
Matias Surdi <[EMAIL PROTECTED]> wrote: >Suppose I've a process P1, which generates itself a lot of data , for >example 2Mb. >Then, I've a process P2 which must access P1 shared memory and, >probably, modify this data. >To accomplish this, I've been digging around python's mmap module, but I >c

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-11 Thread cokofreedom
On Feb 12, 7:16 am, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Erik Max Francis wrote: > > Jeff Schwab wrote: > > >> Erik Max Francis wrote: > >>> Grant Edwards wrote: > > On 2008-02-12, Jeff Schwab <[EMAIL PROTECTED]> wrote: > > Fair enough! > > Dear me, what's Usenet coming to these d

URL in CGI problems

2008-02-11 Thread rodmc
Hi, I am writing a small CGI app which tests if another webpage exists, the pages are on a Wiki system. Anyway when I run the same function (see below) from within IDLE it is ok, however when it is run from within the CGI script I get a socket error:: "URLError: reason = " I am not quite s

Re: which one is more efficient

2008-02-11 Thread Bruno Desthuilliers
Paul Rubin a écrit : >> ki lo wrote: >>> I have type variable which may have been set to 'D' or 'E' >>> >>> Now, which one of following statements are more efficient >>> >>> if type =='D' or type == 'E': >>> >>> or >>> >>> if re.search("D|E", type): >>> >>> Please let me know because the function i

Re: Turn off ZeroDivisionError?

2008-02-11 Thread Steven D'Aprano
On Sun, 10 Feb 2008 23:34:51 +0100, Christian Heimes wrote: > Grant Edwards wrote: >> You must have gone to a different school than I did. I learned that >> for IEEE floating point operations a/0. is INF with the same sign as a >> (except when a==0, then you get a NaN). > > I'm not talking about

idiom to ask if you are on 32 or 64 bit linux platform?

2008-02-11 Thread Jon
Hello everyone, I've got a ctypes wrapper to some code which seems to be different when compiled on 32 bit linux compared to 64 bit linux. For the windows version I can use sys.platform == 'win32' versus 'linux2' to decide whether to get the .dll or .so library to load. Having narrowed it down to

Need Smart Phone with new features? Please click here

2008-02-11 Thread Farooq
www.enmac.com.hk GSM Mobile Phones, Digital iPods, Digital Clocks, Digital Pens, Digital Quran. Enjoy these products with Islamic Features (Complete Holy Quran with Text and Audio, Tafaseer books, Ahadees Books, Daily Supplications, Universal Qibla Direction, Prayer Timing and much more) visit our

Re: packing greyscale values

2008-02-11 Thread John Machin
On Feb 11, 9:11 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > jimgardener wrote: > > hi > > i am getting value of a pixel of a greyscale image using PIL's > > image.getdata and need to pack it as an int as below > > > ie greyvalues > > 127 , 56 , 135 , 99 , 102 , 101 , 146 , 112 , 155 , 154 , 112 ,

Re: packing greyscale values

2008-02-11 Thread bearophileHUGS
Diez B. Roggisch: > Then build up the mapping. Not elegant, but works. For the OP: note that a list suffices, no dict needed. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert markup text to plain text in python?

2008-02-11 Thread Stefan Behnel
geoffbache wrote: > I have some marked up text and would like to convert it to plain text, > by simply removing all the tags. Of course I can do it from first > principles but I felt that among all Python's markup tools there must > be something that would do this simply, without having to create a

Re: packing greyscale values

2008-02-11 Thread Diez B. Roggisch
jimgardener wrote: > hi > i am getting value of a pixel of a greyscale image using PIL's > image.getdata and need to pack it as an int as below > > ie greyvalues > 127 , 56 , 135 , 99 , 102 , 101 , 146 , 112 , 155 , 154 , 112 , 169 > > should become > -4473925, -8289919, -4144960, -5789785, -559

Topographical sorting

2008-02-11 Thread John
I'm working on a project involving the topographical sorting of partially ordered sets (posets), using the poset (S, |), where S is the set of integers <= n. Ultimately, I need to determine all possible topographical sorts for whatever n happens to be. This requires me to be able to build the order

Getting a Foothold on the IDLE Debugger

2008-02-11 Thread W. Watson
I thought I try to step through some simple Python code I wrote with IDLE using Debug. I'm at the early stages of learning Python. I used the shell to Run, then clicked on Debug->Debugger. That brought up a window with Stack and Locals checked. The buttons Go, Step, etc. are greyed out. How do I

Re: Turn off ZeroDivisionError?

2008-02-11 Thread Neal Becker
Mark Dickinson wrote: > On Feb 10, 3:10 pm, [EMAIL PROTECTED] wrote: >> What Python run on a CPU that doesn't handle the nan correctly? > > How about platforms that don't even have nans? I don't think either > IBM's hexadecimal floating-point format, or the VAX floating-point > formats > support

Re: idiom to ask if you are on 32 or 64 bit linux platform?

2008-02-11 Thread Matt Nordhoff
Jon wrote: > Hello everyone, > > I've got a ctypes wrapper to some code which seems to be different > when compiled on 32 bit linux compared to 64 bit linux. For the > windows version I can use sys.platform == 'win32' versus 'linux2' to > decide whether to get the .dll or .so library to load. Havi

Combinatorics

2008-02-11 Thread Michael Robertson
Where is the python equivalent of: http://search.cpan.org/~fxn/Algorithm-Combinatorics-0.16/Combinatorics.pm combinations (with and without repetition) variations (with and without repetition) permutations partitions derangements etc I'm guessing sage has this, but shouldn't something like this

Re: Sending Python statement over socket in chunks

2008-02-11 Thread Jeffrey Barish
Diez B. Roggisch wrote: > Stop reinventing the wheel, start using pyro. Then either return the > list as whole, or if it really is to big, return subsequent slices of it. I am using Pyro. Great package. The problem is getting the chunks to send. I am trying to avoid executing the statement, so

Re: Better way to do this?

2008-02-11 Thread imho
PRC ha scritto: > Hi folks, > > I have a tuple of tuples, in the form--> ((code1, 'string1'),(code2, > 'string2'),(code3, 'string3'),) > > Codes are unique. A dict would probably be the best approach but this > is beyond my control. > > Here is an example: pets = ((0,'cat'),(1,'dog'),(2,'mo

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

mmap and shared memory

2008-02-11 Thread Matias Surdi
Suppose I've a process P1, which generates itself a lot of data , for example 2Mb. Then, I've a process P2 which must access P1 shared memory and, probably, modify this data. To accomplish this, I've been digging around python's mmap module, but I can't figure how to use it without files. Could

Re: Is there an easy way to sort a list by two criteria?

2008-02-11 Thread thebjorn
On Feb 11, 10:47 am, [EMAIL PROTECTED] wrote: [...] > A little known thing from Python 2.5: [...] > >>> sorted(lst, key=itemgetter(2, 1)) Cute, thanks :-) --bjorn -- http://mail.python.org/mailman/listinfo/python-list

Is there a web visitor counter available in Python ...

2008-02-11 Thread W. Watson
... that is free for use without advertising that I can use on my web pages? I have no idea is suitable for this. My knowledge of Python is somewhat minimal at this point. Maybe Java is better choice. -- Wayne Watson (Nevada City, CA) Web Page:

Re: how to find current working user

2008-02-11 Thread Gabriel Genellina
En Mon, 11 Feb 2008 15:21:16 -0200, Praveena Boppudi (c) <[EMAIL PROTECTED]> escribi�: > Can anyone tell me how to find current working user in windows? If it is just informational, use os.environ['USERNAME'] Using win32wnet (from the pywin32 package): py> import win32wnet py> win32wnet.WNetGe

Re: pop langs website ranking

2008-02-11 Thread Joost Diepenmaat
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Questions: > > • paulgraham.com is unusually high. What's up with that? He writes well. Also, if you look at the ranking, end of januari (Arc's first release) was the highest ranking in 4 months. I'm surprised it didn't score higher, actually. >

Re: which one is more efficient

2008-02-11 Thread bearophileHUGS
Steven D'Aprano: bearophile: > > The new string search done by Effbot is really good :-) > Care to explain what "new string search" you're referring to? Inquiring > minds want to know. I meant this good work you can find in Python 2.5: http://effbot.org/zone/stringlib.htm Bye, bearophile -- http

Problem with import

2008-02-11 Thread Victor Lin
Hi, I got some problem with import. I have some python file that should be executed. Something like unit-test or other small tool. The project is not so small. So I want to separate these files into different packages. Might like this: project/ run_task.py pkg1/ __init__.py -

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-11 Thread Steven D'Aprano
On Mon, 11 Feb 2008 19:54:30 +1300, greg wrote: >> Until DeBroglie formulated >> its hypothesis of dual nature of matter (and light): wave and particle >> at the same time. > > Really it's neither waves nor particles, but something else for which > there isn't a good word in everyday English. P

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-11 Thread Jeff Schwab
Erik Max Francis wrote: > Jeff Schwab wrote: > >> So what's the "double mistake?" My understanding was (1) the misuse >> (ok, vernacular use) of the term "free fall," and (2) the association >> of weight with free-fall velocity ("If I tie an elephant's tail to a >> mouse's, and drop them both

Re: packing greyscale values

2008-02-11 Thread Peter Otten
jimgardener wrote: > hi > i am getting value of a pixel of a greyscale image using PIL's > image.getdata and need to pack it as an int as below > > ie greyvalues > 127 , 56 , 135 , 99 , 102 , 101 , 146 , 112 , 155 , 154 , 112 , 169 > > should become > -4473925, -8289919, -4144960, -5789785, -559

Python equivt of __FILE__ and __LINE__

2008-02-11 Thread Bill Davy
Writing a quick and dirty assembler and want to give the user the location of an error. The "assembly language" is Python. If the user wants to generat some object code they write something like: Label(LoopLable) Load(R4) Dec() JNZ(LoopLabel) I can use Python to do all the expres

Re: Is there an easy way to sort a list by two criteria?

2008-02-11 Thread bearophileHUGS
[repost] Duncan Booth: > >>> from operator import itemgetter > >>> lst = [(1,2,4),(3,2,1),(2,2,2),(2,1,4),(2,4,1)] > >>> lst.sort(key=itemgetter(1)) > >>> lst.sort(key=itemgetter(2)) > >>> lst > [(3, 2, 1), (2, 4, 1), (2, 2, 2), (2, 1, 4), (1, 2, 4)] A little known thing from Python 2.5: >>> fro

Re: pop langs website ranking

2008-02-11 Thread greg
[EMAIL PROTECTED] wrote: > Many top ones are due to the popularity of the lang, but also because > their site hosts the lang's documentation and discussion forum (or > wiki,blogs). Hosting a web forum are likely to increase traffic some > 10 or 100 fold. I think this goes to show that you can't re

How to broad cast ping address.......

2008-02-11 Thread Manikandan R
Hai, I am working in Python scripting. I an need to find out all the device connected in the network. Just I planned to broad cast the ping address and use the ARP table to get the IP address of the system in the network. As, I am working in Win XP i am not able to use ping -b command to broad

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 stdout in a >>>block? >> >> Do you mean "without w

Re: Encrypting a short string?

2008-02-11 Thread Paul Rubin
erikcw <[EMAIL PROTECTED]> writes: > In essence what I'm doing is trying to manage tickets for a helpdesk. > I want the ticket identifier to be short enough to fit in the subject > line along with the normal subject chosen by the user. I think you should use a database to maintain the email addre

RE: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-11 Thread Ron Provost
The division between philosophy and science can be fine indeed. Philosophy and science are the two rigorous methods of inquiry into the fundamental nature of things (other methods include religion and superstition). Because of it's process, science limits itself to those questions which can be

Re: Why does list have no 'get' method?

2008-02-11 Thread grflanagan
On Feb 8, 4:24 pm, [EMAIL PROTECTED] wrote: > > > val = BETTER foo THAN bar > > > > ;-) > > > > Cobol-strikes-back-ly yours, > > > > George > > > I use a ETL language/tool that actually has a function for this kind > > of thing: > > > NulltoValue(value,defaultValue) > > > it returns defaultValue if

Re: ANN: pyparsing 1.4.11 released

2008-02-11 Thread bearophileHUGS
Paul McGuire: > - Added '==' short-cut to see if a given string matches a > pyparsing expression. For instance, you can now write: > > integer = Word(nums) > if "123" == integer: ># do something > > print [ x for x in "123 234 asld".split() if x==integer ] > # prints ['12

Re: Displaying Unicode Chars

2008-02-11 Thread Bjoern Schliessmann
"Martin v. Löwis" wrote: > On Linux, try gucharmap or kcharselect. Or gnome-character-map if using Gnome. Regards, Björn -- BOFH excuse #25: Decreasing electron flux -- http://mail.python.org/mailman/listinfo/python-list

Re: wxpython thread question

2008-02-11 Thread Mike Driscoll
On Feb 10, 10:26 pm, [EMAIL PROTECTED] wrote: > I am new to threading and python. Currently I am working on a GUI app > that will be a frontend to CLI client. > > I want to invoke a method of the class from GUI and run it in the > thread. That works well, the problems is I dont know how can I stop

Re: use 'with' to redirect stdout

2008-02-11 Thread Neal Becker
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 yield sys.stdout = orig_stdout if __name__ == "__main__": with redirect (open

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-11 Thread Grant Edwards
On 2008-02-11, Steve Holden <[EMAIL PROTECTED]> wrote: > Well the history of physics for at least two hundred years has > been a migration away from the intuitive. Starting at least as far back as Newtonian mechanics. I once read a very interesting article about some experiments that showed that

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-11 Thread Robert Bossy
Grant Edwards wrote: > On 2008-02-11, Steve Holden <[EMAIL PROTECTED]> wrote: > > >> Well the history of physics for at least two hundred years has >> been a migration away from the intuitive. >> > > Starting at least as far back as Newtonian mechanics. I once > read a very interesting art

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-11 Thread Gabriel Genellina
En Mon, 11 Feb 2008 14:05:27 -0200, Grant Edwards <[EMAIL PROTECTED]> escribi�: > On 2008-02-11, Steve Holden <[EMAIL PROTECTED]> wrote: > >> Well the history of physics for at least two hundred years has >> been a migration away from the intuitive. > > Starting at least as far back as Newtonian

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-11 Thread Jeff Schwab
Erik Max Francis wrote: > Jeff Schwab wrote: > >> Erik Max Francis wrote: >>> Grant Edwards wrote: >>> On 2008-02-12, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Fair enough! Dear me, what's Usenet coming to these days... >>> >>> I know, really. Sheesh! Jeff, I won't stand for th

<    1   2