using python to visit web sites and print the web sites image to files

2007-03-11 Thread imx
Hi there, I wonder whether python can be used to simulate a real user to do the following: 1) open a web site in a browser; 2) printscreen, so to copy the current active window image to clipboard; 3) save the image file to a real file Any pointer will be apprieciated! Xiong -- http://mail.pyth

Re: Watching a file another app is writing

2007-03-11 Thread Gordon Airporte
Nick Vatamaniuc wrote: > You might need to look at pywin32 for Windows specific ways to listen > to "file changed" event. > > On Unix a quick shortcut would be to simply read the output of 'tail - > f ' command... Ah, I forgot I have Cygwin installed, so I do have tail. Unfortunately Windows w

Re: Need help with a string plz! (newbie)

2007-03-11 Thread Hendrik van Rooyen
"Grant Edwards" <[EMAIL PROTECTED]> wrote: > On 2007-03-10, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: > ><[EMAIL PROTECTED]> wrote: > > > >> Oh, thanks for the advice then. And as for Grant..look forward to > >> seeing more of your posts. > > > > YOW! - some recognition at last! > > :) > >

Re: Signed zeros: is this a bug?

2007-03-11 Thread Paddy
On Mar 11, 10:49 pm, "Paddy" <[EMAIL PROTECTED]> wrote: > On Mar 11, 9:28 pm, Paul Rubin wrote: > > > Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > > > >Pardon? What is "the right thing with signed zeros"... In the last > > > 30 years I've been on machines that norm

Re: Watching a file another app is writing

2007-03-11 Thread Nick Vatamaniuc
On Mar 11, 3:36 pm, Gordon Airporte <[EMAIL PROTECTED]> wrote: > I'm trying to find a way to take a file that another program has opened > and writes to periodically, open it simultaneously in Python, and > automatically update some of my objects in Python when the file is > written to. > I can ope

Re: Bitpacked Data

2007-03-11 Thread Nick Vatamaniuc
On Mar 11, 5:49 pm, none <""luca\"@(none)"> wrote: > i need to interface python with a bitpacked data file, > the structure recorded in the file is the following: > > struct { > var_1 4bit > var_2 6bit > var_3 2bit > var_3 4bit > > } > > how can read the struct and convert data into dictionary > >

Re: How to test if a key in a dictionary exists?

2007-03-11 Thread John Machin
On Mar 12, 3:19 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > Paul McGuire <[EMAIL PROTECTED]> wrote: > > will be. For instance, when working with data from 0 to 100 and > > looking for frequencies by decade, you can initialize the histogram- > > dict with: > > > for i in range(10): > > histo

Re: How to test if a key in a dictionary exists?

2007-03-11 Thread Alex Martelli
Paul McGuire <[EMAIL PROTECTED]> wrote: > will be. For instance, when working with data from 0 to 100 and > looking for frequencies by decade, you can initialize the histogram- > dict with: > > for i in range(10): > histodict[i] = 0 A better way, of course (also saving the histodict = {} wh

Re: Signed zeros: is this a bug?

2007-03-11 Thread Mark Dickinson
On Mar 11, 9:56 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > That bug isn't formally closed yet, and the discussion's going on, we'll > see. Meanwhile can you try my patch 1678668 just to double check it > does fix everything? (It's agains the current HEAD of Python's svn). It does, and all te

hotmail / aim / yahoo addressbook importer

2007-03-11 Thread [EMAIL PROTECTED]
Hi Are there any hotmail / aim / yahoo addressbook importer in python? thanks mark -- http://mail.python.org/mailman/listinfo/python-list

How to modify the source of a python file inside a python egg file?

2007-03-11 Thread [EMAIL PROTECTED]
How to modify the source of a python file inside a python egg file? I can see the file by unzipping it, but how can I package it back as a python egg file after my modification. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: setuptools and code.google.com

2007-03-11 Thread Alex Martelli
Jorge Godoy <[EMAIL PROTECTED]> wrote: ... > > these subtleties... thanks for pointing out that there's a problem > > btw!-) > > Thanks for caring ;-) Hey, I'd just love to make it as easy as possible to get gmpy -- that's why I (shudder!-) even build and upload Windows installers... > It lo

setuptools and code.google.com (was Re: Signed zeros: is this a bug?)

2007-03-11 Thread Jorge Godoy
[EMAIL PROTECTED] (Alex Martelli) writes: > I'm not familiar with setuptools, what exactly is it looking for? > > If it's looking for stuff to download it should start at > > http://code.google.com/p/gmpy/downloads/list > > (but what does it want -- the sources' zipfile, or some binary, and in > w

Re: Signed zeros: is this a bug?

2007-03-11 Thread Alex Martelli
Jorge Godoy <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > > Incidentally (and I know you know that, Paul, but others interested in > > this thread might not) fast exact rational arithmetic (based on the LGPL > > library named GMP) is supplied, among other functionalit

Re: Signed zeros: is this a bug?

2007-03-11 Thread Jorge Godoy
[EMAIL PROTECTED] (Alex Martelli) writes: > Incidentally (and I know you know that, Paul, but others interested in > this thread might not) fast exact rational arithmetic (based on the LGPL > library named GMP) is supplied, among other functionality, by module > gmpy, currently found at http://cod

Re: Object instance "reporting" to a container class instance

2007-03-11 Thread Alex Martelli
Daniel Lipovetsky <[EMAIL PROTECTED]> wrote: > I would like for an object to "report" to a container object when a > new instance is created or deleted. I could have a container object > that is called when a new instance is created, as below. > > class AnyObject: > pass > > class Container:

Re: Signed zeros: is this a bug?

2007-03-11 Thread Alex Martelli
Paul Rubin wrote: > (rejected) for Python to support exact rational arithmetic in addition > to floating point and exact integer arithmetic. Exact rationals in > Python (if implemented) should behave like mathematical rationals. > But Python floating point arithmetic sh

Re: Signed zeros: is this a bug?

2007-03-11 Thread Alex Martelli
Tim Peters <[EMAIL PROTECTED]> wrote: ... > It's a bug that keeps resurfacing, probably because there's no portable > way to test that it stays fixed :-( (it's not an accident that the OP > relied on atan2 to distinguish +0.0 from -0.0! they act the same in Please take a look at my patch 1678

Re: Signed zeros: is this a bug?

2007-03-11 Thread Alex Martelli
Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Mar 11, 2:59 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > > [...] > > OTOH, Python 2.4 works just fine...: > > > > Python 2.4.3 (#1, Apr 7 2006, 10:54:33) [GCC 4.0.1 (Apple Computer, > > Inc. build 5250)] on darwin Type "help", "copyright", "credit

Re: Signed zeros: is this a bug?

2007-03-11 Thread Alex Martelli
Alex Martelli <[EMAIL PROTECTED]> wrote: ... > Yep, it sure might, if I can make time to act on it:-). ...and I did -- patch 1678668 is right there, brand newm at . I hope it also satisfies the timbot's very reasonable lament about the bug resurfacing

Re: Signed zeros: is this a bug?

2007-03-11 Thread Alex Martelli
Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Sun, 11 Mar 2007 15:26:01 -0300, Alex Martelli <[EMAIL PROTECTED]> > escribió: > > > Or maybe we should give up ever storing -0.0 in the tables > > of constant and ALWAYS have "0.0, unary-minus" wherever it appears (that > > would presumably requ

Object instance "reporting" to a container class instance

2007-03-11 Thread Daniel Lipovetsky
I would like for an object to "report" to a container object when a new instance is created or deleted. I could have a container object that is called when a new instance is created, as below. class AnyObject: pass class Container: links = [] def add(self,other): while other n

Weekly Python Patch/Bug Summary

2007-03-11 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 380 open (-36) / 3658 closed (+65) / 4038 total (+29) Bugs: 965 open ( -9) / 6555 closed (+35) / 7520 total (+26) RFE : 272 open ( +4) / 253 closed ( +2) / 525 total ( +6) New / Reopened Patches __ Extension

Re: Bitpacked Data

2007-03-11 Thread bearophileHUGS
Bjoern Schliessmann: > I'd use the module struct, with bit shifting operators to extract > the bits. Maybe Pyrex can be used to create a small module that can manage similar bitfields quickly and with a syntax not too much far from the Erlang bit syntax. Bye, bearophile -- http://mail.python.or

Re: Signed zeros: is this a bug?

2007-03-11 Thread André
On Mar 11, 7:49 pm, "Paddy" <[EMAIL PROTECTED]> wrote: > > Isn't negative zero mathematically the same as zero? Isn't -0 just an > artefact of the representation of floating point numbers? Shouldn't > f(0) == f(-0) for all functions f? Read the original post again... The relevant part is: I'

Re: Signed zeros: is this a bug?

2007-03-11 Thread Paul Rubin
"Paddy" <[EMAIL PROTECTED]> writes: > > Most machines these days use IEEE 754 which supports negative zero. > > http://en.wikipedia.org/wiki/Negative_zero > > Isn't negative zero mathematically the same as zero? Isn't -0 just an > artefact of the representation of floating point numbers? Shouldn't

Re: Phase change material ...

2007-03-11 Thread rebeccagcox
Hey, thermate--could you check your post on China from January and respond. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: war with china? a different approach?

2007-03-11 Thread rebeccagcox
Are you there, cause I don't want to waste my time writing a response to that if you're not there anymore. Please respond w/ a new post if you do check this. -- http://mail.python.org/mailman/listinfo/python-list

Re: Signed zeros: is this a bug?

2007-03-11 Thread Michael Spencer
Gabriel Genellina wrote: > > (I cannot find peephole.c on the source distribution for Python 2.5, but > you menctioned it on a previous message, and the comment above refers to > the peephole optimizer... where is it?) > The peephole optimizer is in compile.c - the entry point is optimize_c

Re: Signed zeros: is this a bug?

2007-03-11 Thread Paddy
On Mar 11, 9:28 pm, Paul Rubin wrote: > Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > > >Pardon? What is "the right thing with signed zeros"... In the last > > 30 years I've been on machines that normalize floating zero into a true > > zero (all bits are zero: manti

Re: Signed zeros: is this a bug?

2007-03-11 Thread Paul Rubin
"Mark Dickinson" <[EMAIL PROTECTED]> writes: > By the way, I don't suppose that anybody would be interested in > a rewritten cmath for Python 2.6? It wouldn't be hard for me to > rewrite what I already have in C, and add suitable documentation > and tests. I can't speak for the developers but my

Re: Bitpacked Data

2007-03-11 Thread Bjoern Schliessmann
none wrote: > i need to interface python with a bitpacked data file, > the structure recorded in the file is the following: > > struct { > var_1 4bit > var_2 6bit > var_3 2bit > var_3 4bit > } Strange data types. What language is this? > how can read the struct and convert data into dictionary

Re: a better solution for GUI in python

2007-03-11 Thread ici
On Mar 11, 1:03 pm, "ce" <[EMAIL PROTECTED]> wrote: > Hi, > > My company is using python currently for our website. We need to > develop a GUI front-end for our ERP that would be portable (Windows > and Linux). > > My question is which solution would be better for the GUI (and easier > to implement

Re: Need help with a string plz! (newbie)

2007-03-11 Thread Grant Edwards
On 2007-03-10, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: ><[EMAIL PROTECTED]> wrote: > >> Oh, thanks for the advice then. And as for Grant..look forward to >> seeing more of your posts. > > YOW! - some recognition at last! :) I see somebody pays attention to sigs -- which, BTW, are old quotes

Re: a better solution for GUI in python

2007-03-11 Thread Uwe Grauer
ce wrote: > Hi, > > My company is using python currently for our website. We need to > develop a GUI front-end for our ERP that would be portable (Windows > and Linux). > > My question is which solution would be better for the GUI (and easier > to implement)? I knew there are something like wxidg

Bitpacked Data

2007-03-11 Thread none
i need to interface python with a bitpacked data file, the structure recorded in the file is the following: struct { var_1 4bit var_2 6bit var_3 2bit var_3 4bit } how can read the struct and convert data into dictionary Thnx -- http://mail.python.org/mailman/listinfo/python-list

Re: Signed zeros: is this a bug?

2007-03-11 Thread Mark Dickinson
On Mar 11, 5:15 pm, Tim Peters <[EMAIL PROTECTED]> wrote: It's a bug that keeps resurfacing, probably because there's no portable > way to test that it stays fixed :-( (it's not an accident that the OP > relied on atan2 to distinguish +0.0 from -0.0! they act the same in > /almost/ all contexts).

Re: Signed zeros: is this a bug?

2007-03-11 Thread Paul Rubin
Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > Pardon? What is "the right thing with signed zeros"... In the last > 30 years I've been on machines that normalize floating zero into a true > zero (all bits are zero: mantissa, exponent, and sign). This is the > first time I've even seen a vari

Re: Signed zeros: is this a bug?

2007-03-11 Thread Paul Rubin
Tim Peters <[EMAIL PROTECTED]> writes: > 2.5 introduced a new front end and more ambitious constant-folding, and > I expect the bug showed up again due to one of those. I hope it does get fixed. Not having referential transparency in a basic math function like atan2 is pretty disturbing in a mod

Re: Signed zeros: is this a bug?

2007-03-11 Thread Tim Peters
[attribution lost] ... >>> Yup: the workaround seems to be as simple as replacing all occurrences >>> of -0.0 with -(0.0). I'm embarrassed that I didn't figure this out >>> sooner. >>> >>> >>> x, y = -(0.0), 0.0 >>> >>> x, y >>> (-0.0, 0.0) [Alex Martelli] >> Glad it works for you, but it's the

cherrypy sub-process

2007-03-11 Thread Bart Van Loon
Hi all, I have written a small program in Python which acts as a wrapper around mpd and natd on a FreeBSD system. It gets the status, restarts the processes, etc... Then, I created a tiny cherrypy webapp which provides a webinterface to this program. All works fine, but for the following problem:

Re: Need help in using mod_python

2007-03-11 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Mar 11, 1:02 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > >>[EMAIL PROTECTED] a écrit : >> >> >> >> >>>Hi, >> >>>I am trying to setup Apache with Trac which uses mod_python. I get the >>>following error: >> >>>assert have_pysqlite > 0 >> >>>And I have ver

Re: Signed zeros: is this a bug?

2007-03-11 Thread Mark Dickinson
On Mar 11, 2:59 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > [...] > OTOH, Python 2.4 works just fine...: > > Python 2.4.3 (#1, Apr 7 2006, 10:54:33) > [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin > Type "help", "copyright", "credits" or "license" for more information.>>> > 0.0,-0.0

Re: Signed zeros: is this a bug?

2007-03-11 Thread Gabriel Genellina
En Sun, 11 Mar 2007 15:26:01 -0300, Alex Martelli <[EMAIL PROTECTED]> escribió: > Or maybe we should give up ever storing -0.0 in the tables > of constant and ALWAYS have "0.0, unary-minus" wherever it appears (that > would presumably require working on the AST-to-bytecode visitors that > currentl

Watching a file another app is writing

2007-03-11 Thread Gordon Airporte
I'm trying to find a way to take a file that another program has opened and writes to periodically, open it simultaneously in Python, and automatically update some of my objects in Python when the file is written to. I can open the file and manually readlines() from it to keep up to date, it's

Re: number generator

2007-03-11 Thread Alex Martelli
Army1987 <[EMAIL PROTECTED]> wrote: > "cesco" <[EMAIL PROTECTED]> ha scritto nel messaggio > news:[EMAIL PROTECTED] > >I have to generate a list of N random numbers (integer) whose sum is > > equal to M. If, for example, I have to generate 5 random numbers whose > > sum is 50 a possible solution

Re: Signed zeros: is this a bug?

2007-03-11 Thread Scott David Daniels
Alex Martelli wrote: > Alas, here is the problem...: 0.0 and -0.0 are NOT separate as dict > keys! They are == to each other. So are 0, 0L, and 0+j0, but the > compiler smartly distinguishes these cases by using (obj, type) as the > key (the *types* are distinguished, even though the *values*) ar

Re: any better code to initalize a list of lists?

2007-03-11 Thread Bart Willems
Donald Fredkin wrote: > John wrote: > >> For my code of radix sort, I need to initialize 256 buckets. My code >> looks a little clumsy: >> >> radix=[[]] >> for i in range(255): >>radix.append([]) >> >> any better code to initalize this list? > > radix = [[[]]*256][0] > No I fell for that on

Re: any better code to initalize a list of lists?

2007-03-11 Thread Stargaming
Donald Fredkin schrieb: > John wrote: > > >>For my code of radix sort, I need to initialize 256 buckets. My code >>looks a little clumsy: >> >>radix=[[]] >>for i in range(255): >> radix.append([]) >> >>any better code to initalize this list? > > > radix = [[[]]*256][0] > >>> x = [[[]]*256]

Re: any better code to initalize a list of lists?

2007-03-11 Thread Donald Fredkin
John wrote: > For my code of radix sort, I need to initialize 256 buckets. My code > looks a little clumsy: > > radix=[[]] > for i in range(255): >radix.append([]) > > any better code to initalize this list? radix = [[[]]*256][0] -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Signed zeros: is this a bug?

2007-03-11 Thread Alex Martelli
Alex Martelli <[EMAIL PROTECTED]> wrote: ... > > Yup: the workaround seems to be as simple as replacing all occurrences > > of -0.0 with -(0.0). I'm embarrassed that I didn't figure this out > > sooner. > > > > >>> x, y = -(0.0), 0.0 > > >>> x, y > > (-0.0, 0.0) > > Glad it works for you, but

Re: Python in a Nutshell v2.5 shortcomings

2007-03-11 Thread Alex Martelli
Bjoern Schliessmann <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > > I do know that the 2nd edition of Python in a Nutshell tries to do > > so, but falls quite a bit short on a number of important new > > additions to the library > > Which, if I may ask? For example, all I say about ctyp

Re: Need help in using mod_python

2007-03-11 Thread [EMAIL PROTECTED]
On Mar 11, 1:02 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : > > > > > Hi, > > > I am trying to setup Apache with Trac which uses mod_python. I get the > > following error: > > > assert have_pysqlite > 0 > > > And I have verify this via command line as well, tha

Putting Metaclasses to Work

2007-03-11 Thread Alan Isaac
Forman's book is out of print. Is there a good substitute? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: number generator

2007-03-11 Thread Army1987
"cesco" <[EMAIL PROTECTED]> ha scritto nel messaggio news:[EMAIL PROTECTED] >I have to generate a list of N random numbers (integer) whose sum is > equal to M. If, for example, I have to generate 5 random numbers whose > sum is 50 a possible solution could be [3, 11, 7, 22, 7]. Is there a > simpl

Re: Signed zeros: is this a bug?

2007-03-11 Thread Alex Martelli
Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Mar 11, 1:26 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > > [Long analysis of probable cause of the problem] > > Thank you for this. I was suspecting something along these lines, > but I don't yet know my way around the source well enough to figur

Re: Signed zeros: is this a bug?

2007-03-11 Thread jim-on-linux
# > > Interesting. So on Windows there's probably no > hope of what I want to do working. > But on a platform where the C library does the > right thing with signed zeros, this > behaviour is still a little surprising. I > guess what's happening is that there's > some optimization that a

Re: Signed zeros: is this a bug?

2007-03-11 Thread Mark Dickinson
On Mar 11, 1:26 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > [Long analysis of probable cause of the problem] Thank you for this. I was suspecting something along these lines, but I don't yet know my way around the source well enough to figure out where the problem was coming from. > In the me

Re: threading and iterator crashing interpreter

2007-03-11 Thread Gabriel Genellina
En Sun, 11 Mar 2007 11:35:58 -0300, Janto Dreijer <[EMAIL PROTECTED]> escribió: >> At least, the problem of using the same generator from different threads >> still remains, if you don't use my modified code. In general, when using >> multiple threads you always need some way to syncronize acces

Re: Signed zeros: is this a bug?

2007-03-11 Thread Alex Martelli
Duncan Booth <[EMAIL PROTECTED]> wrote: > "Mark Dickinson" <[EMAIL PROTECTED]> wrote: > > > I guess what's happening is that there's some optimization that avoids > > creating two separate float objects for a float literal that appears > > twice, and that optimization doesn't see the difference b

Re: Signed zeros: is this a bug?

2007-03-11 Thread Mark Dickinson
On Mar 11, 1:21 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Tim Peters wrote inhttp://blog.gmane.org/gmane.comp.python.devel/day=20050409: > > > All Python behavior in the presence of a NaN, infinity, or signed zero > > is a platform-dependent accident. This is because C89 has no such > > concep

Re: Need help in using mod_python

2007-03-11 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > > > Hi, > > I am trying to setup Apache with Trac which uses mod_python. I get the > following error: > > assert have_pysqlite > 0 > > And I have verify this via command line as well, that seem no > problem. (snip) What do you get using tracd (the standalone se

Re: Signed zeros: is this a bug?

2007-03-11 Thread Alex Martelli
Mark Dickinson <[EMAIL PROTECTED]> wrote: > I get the following behaviour on Python 2.5 (OS X 10.4.8 on PowerPC, > in case it's relevant.) > > >>> x, y = 0.0, -0.0 > >>> x, y > (0.0, 0.0) > >>> x, y = -0.0, 0.0 > >>> x, y > (-0.0, -0.0) > > I would have expected y to be -0.0 in the first case, a

Re: Python in a desktop environment

2007-03-11 Thread Bruno Desthuilliers
David Cramer a écrit : > On Mar 10, 10:52 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > >>David Cramer wrote: >> >>>If you had an application that you were about to begin development on >>>which you wanted to be cross platform (at least Mac and Windows), >>>would you suggest using c++ and

Re: Signed zeros: is this a bug?

2007-03-11 Thread Duncan Booth
"Mark Dickinson" <[EMAIL PROTECTED]> wrote: > I guess what's happening is that there's some optimization that avoids > creating two separate float objects for a float literal that appears > twice, and that optimization doesn't see the difference between 0. and > -0. Don't guess. Test. >>> def f

Re: Python in a desktop environment

2007-03-11 Thread Bruno Desthuilliers
David Cramer a écrit : > If you had an application that you were about to begin development on > which you wanted to be cross platform (at least Mac and Windows), > would you suggest using c++ and Python? > > I'm asking because we were originally thinking about doing c# but > after attending PyCon

Re: Parsing Indented Text (like parsing Python)

2007-03-11 Thread Gabriel Genellina
En Sun, 11 Mar 2007 13:12:20 -0300, Paul McGuire <[EMAIL PROTECTED]> escribió: > On Mar 11, 8:37 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> If you mix tabs+spaces, Python simple replaces each tab by 8 spaces. > As I recall, the number of spaces to replace a tab by is something > l

Re: Best place for a function?

2007-03-11 Thread Bruno Desthuilliers
Inyeol Lee a écrit : > On Wed, Mar 07, 2007 at 05:27:04PM -0500, Sergio Correia wrote: > >>I'm writing a class, where one of the methods is kinda complex. The >>method uses a function which I know for certain will not be used >>anywhere else. This function does not require anything from self, only

Re: Parsing Indented Text (like parsing Python)

2007-03-11 Thread John Nagle
Mike Schinkel wrote: > Gabriel Genellina wrote: >>That's why all people always say >>"never mix tabs and spaces" That's the one rule in this area Python ought to enforce. If you've got that, you can convert tabs to spaces, or vice versa, safely. John Nagle --

Re: Signed zeros: is this a bug?

2007-03-11 Thread Mark Dickinson
On Mar 11, 12:13 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Dan Bishop" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | On Mar 11, 9:31 am, "Mark Dickinson" <[EMAIL PROTECTED]> wrote: > | > I get the following behaviour on Python 2.5 (OS X 10.4.8 on PowerPC, > | > in case i

Re: PIL: reading bytes from Image

2007-03-11 Thread Max Erickson
"cyberco" <[EMAIL PROTECTED]> wrote: > Thanks, > > I've tried the StringIO option as follows: > > = > img = Image.open('/some/path/img.jpg') > img.thumbnail((640,480)) > file = StringIO, StringIO() Is the above line exactly what you tried? If it is, the comma and

Re: Parsing Indented Text (like parsing Python)

2007-03-11 Thread Paul McGuire
On Mar 11, 8:37 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > If you mix tabs+spaces, Python simple replaces each tab by 8 spaces. > Are you sure about this? This is not the tab problem I am familiar with in the past. In the following sample, the columnar text labeled 'col2' should al

Re: Signed zeros: is this a bug?

2007-03-11 Thread Terry Reedy
"Dan Bishop" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On Mar 11, 9:31 am, "Mark Dickinson" <[EMAIL PROTECTED]> wrote: | > I get the following behaviour on Python 2.5 (OS X 10.4.8 on PowerPC, | > in case it's relevant.) | > | > >>> x, y = 0.0, -0.0 | > >>> x, y | > (0.0, 0.0)

Re: PIL: reading bytes from Image

2007-03-11 Thread cyberco
Thanks, I've tried the StringIO option as follows: = img = Image.open('/some/path/img.jpg') img.thumbnail((640,480)) file = StringIO, StringIO() img.save(file, 'JPEG') = But it gives me: = exceptio

Re: Signed zeros: is this a bug?

2007-03-11 Thread jim-on-linux
On Sunday 11 March 2007 10:31, Mark Dickinson wrote: > I get the following behaviour on Python 2.5 (OS > X 10.4.8 on PowerPC, in case it's relevant.) > > >>> x, y = 0.0, -0.0 > >>> x, y > > (0.0, 0.0) > > >>> x, y = -0.0, 0.0 > >>> x, y > > (-0.0, -0.0) > > I would have expected y to be -0.0 in th

Re: Signed zeros: is this a bug?

2007-03-11 Thread Dan Bishop
On Mar 11, 9:31 am, "Mark Dickinson" <[EMAIL PROTECTED]> wrote: > I get the following behaviour on Python 2.5 (OS X 10.4.8 on PowerPC, > in case it's relevant.) > > >>> x, y = 0.0, -0.0 > >>> x, y > (0.0, 0.0) > >>> x, y = -0.0, 0.0 > >>> x, y > > (-0.0, -0.0) > > I would have expected y to be -0.0

Signed zeros: is this a bug?

2007-03-11 Thread Mark Dickinson
I get the following behaviour on Python 2.5 (OS X 10.4.8 on PowerPC, in case it's relevant.) >>> x, y = 0.0, -0.0 >>> x, y (0.0, 0.0) >>> x, y = -0.0, 0.0 >>> x, y (-0.0, -0.0) I would have expected y to be -0.0 in the first case, and 0.0 in the second. Should the above be considered a bug, or i

Re: a better solution for GUI in python

2007-03-11 Thread Casey Hawthorne
For a browser interface have you thought of Ajax and possibly WPF/E? http://en.wikipedia.org/wiki/AJAX http://en.wikipedia.org/wiki/Windows_Presentation_Foundation -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: threading and iterator crashing interpreter

2007-03-11 Thread Janto Dreijer
On Mar 11, 3:27 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sun, 11 Mar 2007 09:47:34 -0300, Janto Dreijer <[EMAIL PROTECTED]> > escribió: > > > As far as I can tell I'm not running it from restricted mode > > explicitly. > > This error is rather strange then: > > > > RuntimeError: inst

Re: Python books?

2007-03-11 Thread Tommy Nordgren
On 9 mar 2007, at 04.06, Tommy Nordgren wrote: > Could some kind soul please recommend a few text books on Python 2.5 > and it's class library? > I've found one interesting text book on Python: Mark Lutz - Programming Python, 3rd Edition. How do you rate it? One of the reasons I f

RE: Parsing Indented Text (like parsing Python)

2007-03-11 Thread Mike Schinkel
Gabriel Genellina wrote: > > The problem is, how do I figure out how > > many spaces represent a tab? > > You can't, unless you have more context. How does Python do it? > > one case, someone could have their editor configured to > > allow tabs to use 3 spaces and the user could > > intermingl

Re: Parsing Indented Text (like parsing Python)

2007-03-11 Thread Gabriel Genellina
En Sun, 11 Mar 2007 10:09:57 -0300, Mike Schinkel <[EMAIL PROTECTED]> escribió: > The problem is, how do I figure out how many spaces represent a tab? In You can't, unless you have more context. > one > case, someone could have their editor configured to allow tabs to use 3 > spaces and the us

Re: threading and iterator crashing interpreter

2007-03-11 Thread Gabriel Genellina
En Sun, 11 Mar 2007 09:47:34 -0300, Janto Dreijer <[EMAIL PROTECTED]> escribió: > As far as I can tell I'm not running it from restricted mode > explicitly. This error is rather strange then: > > RuntimeError: instance.__dict__ not accessible in restricted mode "restricted mode" means that th

Re: Parsing Indented Text (like parsing Python)

2007-03-11 Thread Stef Mientki
> > The problem is, how do I figure out how many spaces represent a tab? In one > case, someone could have their editor configured to allow tabs to use 3 > spaces and the user could intermingle tabs and spaces. In other cases, a > user might have their editor configured to have a tab equal 8 space

RE: Parsing Indented Text (like parsing Python)

2007-03-11 Thread Mike Schinkel
Gabriel Genellina wrote: > Start with IC = Previous IC = 0, and a stack with a single 0 > element For each line in the file: >compute the indentation column IC (that is, count the > number of leading whitespace characters; perhaps replacing > tabs as 8 spaces) >compare IC with the Previo

Re: Database module & multithreading

2007-03-11 Thread Gabriel Genellina
En Sun, 11 Mar 2007 09:19:51 -0300, Jon Ribbens <[EMAIL PROTECTED]> escribió: > In article <[EMAIL PROTECTED]>, > Gabriel Genellina wrote: > I don't know, but stock Python 2.5 seems to stick mysterious '.egg' > files in the site-packages directory when you install things. Whi

Re: threading and iterator crashing interpreter

2007-03-11 Thread Janto Dreijer
On Mar 11, 1:46 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sun, 11 Mar 2007 07:32:04 -0300, Janto Dreijer <[EMAIL PROTECTED]> > escribió: > > > > > I have been having problems with the Python 2.4 and 2.5 interpreters > > on both Linux and Windows crashing on me. Unfortunately it's rath

Re: threading and iterator crashing interpreter

2007-03-11 Thread Janto Dreijer
On Mar 11, 2:20 pm, Bjoern Schliessmann wrote: > Janto Dreijer wrote: > > I have been having problems with the Python 2.4 and 2.5 > > interpreters on both Linux and Windows crashing on me. > > I don't understand -- does the interpreter crash (segfault) or is > just your program terminating due to

Re: distributed queue?

2007-03-11 Thread Bjoern Schliessmann
Paul Rubin wrote: > Bjoern Schliessmann <[EMAIL PROTECTED]> >> (Why does everyone think that "concurrency" equals "usage of >> multiple threads"?) > > Well, it doesn't necessarily, but that's easiest a lot of the > time. I don't think so. Personally, I like multiplexing better. I think it has le

Re: a better solution for GUI in python

2007-03-11 Thread Jarek Zgoda
Bjoern Schliessmann napisał(a): >> I'd recommend pyGTK. It's easy to use, delivers astonishing >> results and is perfectly portable as far as I know. > > And how does it look on Windows? :) On styled Windows XP it looks like any other styled application (counting those Qt and wx based). On Win

Re: a better solution for GUI in python

2007-03-11 Thread ce
On Mar 11, 3:05 pm, Paul Rubin wrote: > "ce" <[EMAIL PROTECTED]> writes: > > My company is using python currently for our website. We need to > > develop a GUI front-end for our ERP that would be portable (Windows > > and Linux). > > Some reason not to use a browser inter

Re: threading and iterator crashing interpreter

2007-03-11 Thread Bjoern Schliessmann
Janto Dreijer wrote: > I have been having problems with the Python 2.4 and 2.5 > interpreters on both Linux and Windows crashing on me. I don't understand -- does the interpreter crash (segfault) or is just your program terminating due to unhandled exceptions? Regards, Björn -- BOFH excuse #

Re: Database module & multithreading

2007-03-11 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Gabriel Genellina wrote: I don't know, but stock Python 2.5 seems to stick mysterious '.egg' files in the site-packages directory when you install things. >>> >>> Which "stock" Python? Not the one from www.python.org... >> >> Yes, the one from www.python.or

Re: a better solution for GUI in python

2007-03-11 Thread Bjoern Schliessmann
StD wrote: > I'd recommend pyGTK. It's easy to use, delivers astonishing > results and is perfectly portable as far as I know. And how does it look on Windows? :) > I'm working with it myself, having the goal of simplicity as well > as portability and I got to say, it works! Hope that was helpf

Re: a better solution for GUI in python

2007-03-11 Thread Bjoern Schliessmann
ce wrote: > My question is which solution would be better for the GUI (and > easier to implement)? I knew there are something like wxidgets, (wxWidgets. It's the C++ lib, its Python bindings are wxPython) > QT (same as above, it's called pyQt. Check licensing, it's not as liberal as the others'

Re: a better solution for GUI in python

2007-03-11 Thread Paul Rubin
"ce" <[EMAIL PROTECTED]> writes: > My company is using python currently for our website. We need to > develop a GUI front-end for our ERP that would be portable (Windows > and Linux). Some reason not to use a browser interface instead of a client gui? -- http://mail.python.org/mailman/listinfo/py

Re: Database module & multithreading

2007-03-11 Thread Gabriel Genellina
En Sun, 11 Mar 2007 07:55:15 -0300, Jon Ribbens <[EMAIL PROTECTED]> escribió: > In article <[EMAIL PROTECTED]>, > Gabriel Genellina wrote: >>> I don't know, but stock Python 2.5 seems to stick mysterious '.egg' >>> files in the site-packages directory when you install things. >> >> Which "stoc

Re: a better solution for GUI in python

2007-03-11 Thread StD
On 11 Mrz., 12:03, "ce" <[EMAIL PROTECTED]> wrote: > Hi, > > My company is using python currently for our website. We need to > develop a GUI front-end for our ERP that would be portable (Windows > and Linux). > > My question is which solution would be better for the GUI (and easier > to implement)

Re: threading and iterator crashing interpreter

2007-03-11 Thread Gabriel Genellina
En Sun, 11 Mar 2007 07:32:04 -0300, Janto Dreijer <[EMAIL PROTECTED]> escribió: > I have been having problems with the Python 2.4 and 2.5 interpreters > on both Linux and Windows crashing on me. Unfortunately it's rather > complex code and difficult to pin down the source. > > So I've been tryin

Re: Parsing Indented Text (like parsing Python)

2007-03-11 Thread Gabriel Genellina
En Sun, 11 Mar 2007 06:34:03 -0300, Mike Schinkel <[EMAIL PROTECTED]> escribió: > I'm trying to write an app that parses a text file containing an outline > useing essentially the same indentation rules as Python source code, i.e. > the first level has no indent, the second level has one indent,

  1   2   >