python resource management

2009-01-19 Thread S.Selvam Siva
Hi all, I am running a python script which parses nearly 22,000 html files locally stored using BeautifulSoup. The problem is the memory usage linearly increases as the files are being parsed. When the script has crossed parsing 200 files or so, it consumes all the available RAM and The CPU usage

Re: Event Handling and Signal-Slot Mechanism

2009-01-19 Thread James Mills
On Mon, Jan 19, 2009 at 5:49 PM, Steven Woody wrote: > I am reading mark summerfield's book Rapid GUI Programming with Python > and Qt, chapter 6. In the example code, it inserted customized > behavior when user selects file->exit by overriding closeEvent() event > handler, but in other context, w

Re: problem in implementing multiprocessing

2009-01-19 Thread Carl Banks
On Jan 18, 10:00 pm, "James Mills" wrote: > On Mon, Jan 19, 2009 at 3:50 PM, gopal mishra wrote: > > i know this is not an io - bound problem, i am creating heavy objects in the > > process and add these objects in to queue and get that object in my main > > program using queue. > > you can test

Re: Possible bug in Tkinter - Python 2.6

2009-01-19 Thread Eric Brunel
On Fri, 16 Jan 2009 17:49:50 +0100, Terry Reedy wrote: Eric Brunel wrote: On Thu, 15 Jan 2009 23:49:22 +0100, Terry Reedy wrote: Eric Brunel wrote: [snip]>> And BTW, if this is actually a bug, where can I report it? bugs.python.org Thanks. I reported the problem. When you report tha

Re: Possible bug in Tkinter - Python 2.6

2009-01-19 Thread Eric Brunel
On Sun, 18 Jan 2009 01:57:12 +0100, José Matos wrote: On Friday 16 January 2009 09:47:36 Eric Brunel wrote: What do you mean by 'works'...? The usual meaning, I think. :-) Click "Yes" and the program prints True, click "No" and the programs prints "False". This is not the procedure I d

Re: Python 2.6's multiprocessing lock not working on second use?

2009-01-19 Thread Nick Craig-Wood
Gabriel Genellina wrote: > En Fri, 16 Jan 2009 14:41:21 -0200, escribiste en el grupo > gmane.comp.python.general > > > I ran a few tests on the new Python 2.6 multiprocessing module before > > migrating a threading code, and found out the locking code is not > > working well. In this case, a p

I don't understand this syntax error

2009-01-19 Thread Antoon Pardon
I'm probably looking right over it, but for the moment I'm stumped. Can someone explain what is wrong. I'm running python 2.5.2 here This is the code: class vslice(object): def __init__(self, fun): self.fun = fun def __getitem__(self, inx): if not isinstance(inx, tuple): inx =

Re: I don't understand this syntax error

2009-01-19 Thread Peter Otten
Antoon Pardon wrote: > I'm probably looking right over it, but for the moment > I'm stumped. Can someone explain what is wrong. I'm running > python 2.5.2 here > > This is the code: > @vslice > class IdSet(object): Class decorators require Python 2.6 Peter -- http://mail.python.org/mailman/li

issue

2009-01-19 Thread amin
Hi dears. I started programing with python and want to use a suitable database.But I Know nothing about them.please introduse one to me. thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.6's multiprocessing lock not working on second use?

2009-01-19 Thread Frédéric Sagnes
On Jan 17, 11:32 am, "Gabriel Genellina" wrote: > En Fri, 16 Jan 2009 14:41:21 -0200, escribiste en el grupo > gmane.comp.python.general > > > I ran a few tests on the new Python 2.6multiprocessingmodule before > > migrating a threading code, and found out the locking code is not > > working well.

Re: issue

2009-01-19 Thread Patrick Steiger
What kind of database do you need? Relational Databases? The three major databases you can work with python are SQLite, MySQL and PostgreSQL (favorite of mine.) SQLite already comes with python. Try: >>> import sqlite3 SQLite is... Lite. All the informations are stored in a single file. MySQL

Re: issue

2009-01-19 Thread Tim Chase
I started programing with python and want to use a suitable database.But I Know nothing about them.please introduse one to me. thanks. Since you're just starting out, I'd just use the built-in (as of Python2.5) sqlite >>> import sqlite3 >>> c = sqlite3.connect('tmp/test.db') >>> cur = c.c

Getting OSError, Could someone suggest?

2009-01-19 Thread srinivasan srinivas
Hi,  I have written a script which will spawn more than 200 no of subprocesses. I have used subprocess.Popen to do that.  OSError: [Error 24] Too many open files. Could someone help me in fixing this error? Thanks, Srini Add more friends to your messenger and enjoy! Go to http://messen

Re: Getting OSError, Could someone suggest?

2009-01-19 Thread Steven D'Aprano
On Mon, 19 Jan 2009 15:47:00 +0530, srinivasan srinivas wrote: > Hi, >  I have written a script which will spawn more than 200 no of >  subprocesses. I have used subprocess.Popen to do that. > >  OSError: [Error 24] Too many open files. > > Could someone help me in fixing this error? Open fewer

Re: Getting OSError, Could someone suggest?

2009-01-19 Thread Patrick Steiger
2009/1/19 Steven D'Aprano > On Mon, 19 Jan 2009 15:47:00 +0530, srinivasan srinivas wrote: > > > Hi, > > I have written a script which will spawn more than 200 no of > > subprocesses. I have used subprocess.Popen to do that. > > > > OSError: [Error 24] Too many open files. > > > > Could someon

Re: English-like Python

2009-01-19 Thread Marco Mariani
The Music Guy wrote: Just out of curiousity, have there been any attempts to make a version of Python that looks like actual English text? Many have tried that in the decades, but IMHO the best approach is to just rename the language. We cannot do that since it's already been trademarked fo

Re: problem in implementing multiprocessing

2009-01-19 Thread Aaron Brady
On Jan 19, 3:09 am, Carl Banks wrote: snip > Since multiprocessing serializes and deserializes the data while > passing > it from process to process, passing very large objects would have a > very > high latency and overhead.  IOW, gopal's diagnosis is correct.  It's > just not practical to share

tasklet library based on PEP 0342

2009-01-19 Thread charlie137
Hello all, Using new features of python generators, as described in PEP 0342, it is possible to write some sort of "tasklets" in a maner very similar to stackless python, but running on cpython. For example : @tasklet def my_task(): yield Timer(10) yield "result" @tasklet def other_task(

Can I run an operation on an object's attribute when reading?

2009-01-19 Thread Phillip B Oldham
Is it possible to automatically run an operation on a object's attribute when reading? For instance, if I have the following: class Item(object): tags = ['default','item'] item = Item() desc = item.tags When I'm reading the item.tags, I'd like to automagically have the value converted to a st

Re: Can I run an operation on an object's attribute when reading?

2009-01-19 Thread Chris Rebert
On Mon, Jan 19, 2009 at 4:04 AM, Phillip B Oldham wrote: > Is it possible to automatically run an operation on a object's > attribute when reading? For instance, if I have the following: > > class Item(object): > tags = ['default','item'] > > item = Item() > > desc = item.tags > > When I'm readin

Re: Can I run an operation on an object's attribute when reading?

2009-01-19 Thread Phillip B Oldham
On Mon, Jan 19, 2009 at 12:15 PM, Chris Rebert wrote: > Assuming I'm interpreting you correctly (you're going to have to use > something like a getter): Thanks, but I'm looking for a way to do it *without* using a getter as I don't have easy access to the class (its being generated for me elsewhe

Re: Can I run an operation on an object's attribute when reading?

2009-01-19 Thread Chris Rebert
On Mon, Jan 19, 2009 at 4:22 AM, Phillip B Oldham wrote: > On Mon, Jan 19, 2009 at 12:15 PM, Chris Rebert wrote: >> Assuming I'm interpreting you correctly (you're going to have to use >> something like a getter): > > Thanks, but I'm looking for a way to do it *without* using a getter as > I don'

Re: Can I run an operation on an object's attribute when reading?

2009-01-19 Thread Ben Finney
Phillip B Oldham writes: > Thanks, but I'm looking for a way to do it *without* using a getter > as I don't have easy access to the class (its being generated for me > elsewhere). Essentially I'd like to overwrite (if possible) the > default behavior when returning certain attributes on certain >

Re: Can I run an operation on an object's attribute when reading?

2009-01-19 Thread Michael Hartl
Phillip B Oldham schrieb: On Mon, Jan 19, 2009 at 12:15 PM, Chris Rebert wrote: Assuming I'm interpreting you correctly (you're going to have to use something like a getter): Thanks, but I'm looking for a way to do it *without* using a getter as I don't have easy access to the class (

Simple image manipulation question

2009-01-19 Thread AlienBaby
Hi, Could anyone point me toward the right modules etc.. that would help with; loading an image file rendering some text onto that image saveing the image file I've looked into Tkinter, but that seems to require working with canvases etc.., but I do not need to actually display the image, just

Re: Difference between Python 2.2.2 and Python 2.5

2009-01-19 Thread Ravi
On Jan 18, 8:44 pm, Steven D'Aprano wrote: > On Sun, 18 Jan 2009 07:30:52 -0800, Ravi wrote: > > I am developing for PyS60 1.4.4 which supports Python 2.2.2 while what I > > know is Python 2.5  . > > > Can you please tell me differences between the two so that I can save > > myself from incompatib

Re: Can I run an operation on an object's attribute when reading?

2009-01-19 Thread Ben Finney
Ben Finney writes: > You can override the behaviour of a class by defining a subclass. > > class UntouchableTypeWrapper(UntouchableType): > > def _foo_get(self): > return str(self.foo) > > foo = property(_foo_get) Which, I realise now, won't work (and I didn't

output problem

2009-01-19 Thread Jean-Paul VALENTIN
true, Windows automatically adds a newline after the program output. But maybe there is a workaround? When you launch x.bat containing no char, windows adds a newline after the program output. But when you launch x.bat finishing with at least one CRLF, windows does not add a newline after the progr

Yaro vs WebOb

2009-01-19 Thread Ron Garret
I'm selecting infrastructure for a web development and I've found two lightweight frameworks that seem to offer a lot of bang-for-the-byte: Yaro and WebOb. I'm wondering if anyone here has used either or both and has opinions about them. What has been your experience with them? Which do you

Re: import urllib2 fails with Python 2.6.1 on Vista

2009-01-19 Thread Gabriel Genellina
En Sun, 18 Jan 2009 16:08:07 -0200, Scott MacDonald escribió: Ah yes, with your help I seem to have solved my own problem. I had PYTHONPATH defined to point to the 2.5 directory. Best to avoid setting PYTHONPATH at all. If you install new packages into a standard place like site-packages

Re: Simple image manipulation question

2009-01-19 Thread bearophileHUGS
AlienBaby: > PIL looked promising, but I couldn't see how to put text into the > image once loaded. A 15-second long Google search gives me: http://nedbatchelder.com/blog/200801/truly_transparent_text_with_pil.html Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: import urllib2 fails with Python 2.6.1 on Vista

2009-01-19 Thread Gabriel Genellina
En Sun, 18 Jan 2009 16:08:07 -0200, Scott MacDonald escribió: Ah yes, with your help I seem to have solved my own problem. I had PYTHONPATH defined to point to the 2.5 directory. Best to avoid setting PYTHONPATH at all. If you install new packages into a standard place like site-packages

Re: Python 2.6's multiprocessing lock not working on second use?

2009-01-19 Thread Frédéric Sagnes
On Jan 19, 11:53 am, Frédéric Sagnes wrote: > On Jan 17, 11:32 am, "Gabriel Genellina" > wrote: > > > > > En Fri, 16 Jan 2009 14:41:21 -0200, escribiste en el grupo > > gmane.comp.python.general > > > > I ran a few tests on the new Python 2.6multiprocessingmodule before > > > migrating a threadin

Re: Can I run an operation on an object's attribute when reading?

2009-01-19 Thread Steven D'Aprano
On Mon, 19 Jan 2009 04:04:23 -0800, Phillip B Oldham wrote: > Is it possible to automatically run an operation on a object's attribute > when reading? For instance, if I have the following: > > class Item(object): > tags = ['default','item'] > > item = Item() > > desc = item.tags > > When I'

Re: Difference between Python 2.2.2 and Python 2.5

2009-01-19 Thread Steven D'Aprano
On Mon, 19 Jan 2009 04:47:39 -0800, Ravi wrote: > On Jan 18, 8:44 pm, Steven D'Aprano cybersource.com.au> wrote: >> On Sun, 18 Jan 2009 07:30:52 -0800, Ravi wrote: >> > I am developing for PyS60 1.4.4 which supports Python 2.2.2 while >> > what I know is Python 2.5  . >> >> > Can you please tell

Regexp

2009-01-19 Thread gervaz
Hi all, I need to find all the address in a html source page, I'm using: 'href="(?Phttp://mysite.com/[^"]+)">()?(?P[^]+)()?' but the [^]+ pattern retrieve all the strings not containing < or / or a etc, although I just not want the word "". How can I specify: 'do not search the string "blabla"?' T

Re: import urllib2 fails with Python 2.6.1 on Vista

2009-01-19 Thread Scott MacDonald
I think I set it a long time ago to get the python VTK bindings working... On Mon, Jan 19, 2009 at 5:58 AM, Gabriel Genellina wrote: > En Sun, 18 Jan 2009 16:08:07 -0200, Scott MacDonald < > [email protected]> escribió: > > Ah yes, with your help I seem to have solved my own problem.

Python Style Guide Questions - Contd.

2009-01-19 Thread koranthala
Hi, I have some more questions about python code styling. 1. Global Variables: In my code, I am using some global variables. Now, when I ran PyLint, it raised convention errors mentioning that they should be CAPITAL_ALPHABETS. Now, in PEP 8, I did not see that mentioned. Please let me know wh

Re: Python 2.6's multiprocessing lock not working on second use?

2009-01-19 Thread Jesse Noller
On Mon, Jan 19, 2009 at 8:16 AM, Frédéric Sagnes wrote: > On Jan 19, 11:53 am, Frédéric Sagnes wrote: >> On Jan 17, 11:32 am, "Gabriel Genellina" >> wrote: >> >> >> >> > En Fri, 16 Jan 2009 14:41:21 -0200, escribiste en el grupo >> > gmane.comp.python.general >> >> > > I ran a few tests on the n

Re: Overriding base class methods in the C API

2009-01-19 Thread Gabriel Genellina
En Sun, 18 Jan 2009 22:18:59 -0200, Floris Bruynooghe escribió: I've been trying to figure out how to override methods of a class in the C API. For Python code you can just redefine the method in your subclass, but setting tp_methods on the type object does not seem to have any influcence.

Re: tasklet library based on PEP 0342

2009-01-19 Thread Gabriel Genellina
En Mon, 19 Jan 2009 09:59:17 -0200, escribió: Using new features of python generators, as described in PEP 0342, it is possible to write some sort of "tasklets" in a maner very similar to stackless python, but running on cpython. For example : [...] This kind of tool is very useful, but unfortu

Re: Regexp

2009-01-19 Thread MRAB
gervaz wrote: Hi all, I need to find all the address in a html source page, I'm using: 'href="(?Phttp://mysite.com/[^"]+)">()?(?P[^]+)()?' but the [^]+ pattern retrieve all the strings not containing < or / or a etc, although I just not want the word "". How can I specify: 'do not search the stri

python processes and Visual Studio

2009-01-19 Thread bill
All, This may sound somewhat convoluted, but here goes: 1. I have a Python script that invokes builds in Visual Studio via the command line interface - 'devenv' 2. It works GREAT 3. I have added a post_build event to a VS Solution that has but one project. 4. This event invokes a Python command -

Re: Python Style Guide Questions - Contd.

2009-01-19 Thread Diez B. Roggisch
koranthala wrote: > Hi, >I have some more questions about python code styling. >1. Global Variables: In my code, I am using some global variables. > Now, when I ran PyLint, it raised convention errors mentioning that > they should be CAPITAL_ALPHABETS. Now, in PEP 8, I did not see that > m

Re: python resource management

2009-01-19 Thread Philip Semanchuk
On Jan 19, 2009, at 3:12 AM, S.Selvam Siva wrote: Hi all, I am running a python script which parses nearly 22,000 html files locally stored using BeautifulSoup. The problem is the memory usage linearly increases as the files are being parsed. When the script has crossed parsing 200 files

Re: string formatting documentation

2009-01-19 Thread Alan G Isaac
On 1/17/2009 3:59 PM Ned Deily apparently wrote: Ah, so the rumors are true: we are supposed to prefer '{0:>10}'.format('wtf?') to '%10s' % 'wtf?' and '{{0}}{0}'.format('wtf?').format('wtf?') to '%%s%s' % 'wtf?

Re: Regexp

2009-01-19 Thread Diez B. Roggisch
gervaz wrote: > Hi all, I need to find all the address in a html source page, I'm > using: > 'href="(?Phttp://mysite.com/[^"]+)">()?(?P[^]+)( b>)?' > but the [^]+ pattern retrieve all the strings not containing < > or / or a etc, although I just not want the word "". How can I > specify: 'do not s

Re: Regexp

2009-01-19 Thread Peter Otten
gervaz wrote: > Hi all, I need to find all the address in a html source page, I'm > using: > 'href="(?Phttp://mysite.com/[^"]+)">()?(?P[^]+)( b>)?' > but the [^]+ pattern retrieve all the strings not containing < > or / or a etc, although I just not want the word "". How can I > specify: 'do not s

Re: Regexp

2009-01-19 Thread Ant
A 0-width positive lookahead is probably what you want here: >>> s = """ ... hdhd http://mysite.com/blah.html";>Test String OK ... ... """ >>> p = r'href="(http://mysite.com/[^"]+)">(.*)(?=)' >>> m = re.search(p, s) >>> m.group(1) 'http://mysite.com/blah.html' >>> m.group(2) 'Test String OK' The

Re: string formatting documentation

2009-01-19 Thread Steven D'Aprano
On Mon, 19 Jan 2009 14:44:01 +, Alan G Isaac wrote: > On 1/17/2009 3:59 PM Ned Deily apparently wrote: >> > > > Ah, so the rumors are true: > we are supposed to prefer > '{0:>10}'.format('wtf?') > to > '%10s

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Bruno Desthuilliers
Russ P. a écrit : On Jan 18, 9:22 am, Bruno Desthuilliers wrote: Properties by themselves are not the problem, quite on the contrary - as you say, they actually help wrt/ encapsulation. What breaks encapsulation is *automatic generation* for properties for *each and any* implementation attribu

Re: issue

2009-01-19 Thread D'Arcy J.M. Cain
On Mon, 19 Jan 2009 03:01:53 -0800 "Patrick Steiger" wrote: > MySQL and PostgreSQL are more complete databases that run as servers on the > machine, and you can use python bindings for both. (psycopg2 for postgres, > and i forgot what binds mysql to python at the moment.) There are more than one

Re: string formatting documentation

2009-01-19 Thread Alan G Isaac
On Mon, 19 Jan 2009 14:44:01 +, Alan G Isaac wrote: we are supposed to prefer '{0:>10}'.format('wtf?') to '%10s' % 'wtf?' and '{{0}}{0}'.format('wtf?').format('wtf?') to '%%s%s' % 'wtf?' % 'wtf?' On 1/19/2009 10:01 AM Steven D'Aprano apparently wrote: Well, that second example certainly

Re: Regexp

2009-01-19 Thread gervaz
On Jan 19, 4:01 pm, Ant wrote: > A 0-width positive lookahead is probably what you want here: > > >>> s = """ > > ... hdhd http://mysite.com/blah.html";>Test String OK a> > ... > ... """>>> p = r'href="(http://mysite.com/[^"]+)">(.*)(?=)' > >>> m = re.search(p, s) > >>> m.group(1) > > 'http://mysi

Regular expression that skips single line comments?

2009-01-19 Thread martinjamesevans
I am trying to parse a set of files that have a simple syntax using RE. I'm interested in counting '$' expansions in the files, with one minor consideration. A line becomes a comment if the first non-white space character is a semicolon. e.g. tests 1 and 2 should be ignored sInput = """ ; $1 tes

Re: Regular expression that skips single line comments?

2009-01-19 Thread MRAB
[email protected] wrote: I am trying to parse a set of files that have a simple syntax using RE. I'm interested in counting '$' expansions in the files, with one minor consideration. A line becomes a comment if the first non-white space character is a semicolon. e.g. tests 1 and 2 shou

Re: Regular expression that skips single line comments?

2009-01-19 Thread Tim Chase
I am trying to parse a set of files that have a simple syntax using RE. I'm interested in counting '$' expansions in the files, with one minor consideration. A line becomes a comment if the first non-white space character is a semicolon. e.g. tests 1 and 2 should be ignored sInput = """ ; $1 te

Re: Regexp

2009-01-19 Thread Diez B. Roggisch
gervaz wrote: > On Jan 19, 4:01 pm, Ant wrote: >> A 0-width positive lookahead is probably what you want here: >> >> >>> s = """ >> >> ... hdhd http://mysite.com/blah.html";>Test String OK> a> >> ... >> ... """>>> p = r'href="(http://mysite.com/[^"]+)">(.*)(?=)' >> >>> m = re.search(p, s) >> >>>

Re: Event Handling and Signal-Slot Mechanism

2009-01-19 Thread BlueBird
On Jan 19, 4:10 am, Steven Woody wrote: > Hi, > > Python has Signal-Slot mechanism, Python does not have signal/slot mechanism. You are talking about the Qt toolkit, which is initially a (nice) C++ toolkit, available also in python via the PyQt wrapper. Signal/slots were introduced by Qt to make

Re: Regular expression that skips single line comments?

2009-01-19 Thread Casey
Another option (I cheated a little and turned sInput into a sequence of lines, similar to what you would get reading a text file): sInput = [ '; $1 test1', '; test2 $2', 'test3 ; $3 $3 $3', 'test4', '$5 test5', ' $6', ' test7 $7 test7', ] import re re_exp =

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Rhamphoryncus
On Jan 18, 12:51 pm, "Russ P." wrote: > And even if all your developers were excellent, data hiding would > still be a convenient mechanism to simplify their jobs so they can > focus on higher level problems -- and not have to rely on an ugly > naming convention. That's just it — the cost of main

Re: *Advanced* Python book?

2009-01-19 Thread Jeff McNeil
On Jan 18, 6:35 pm, Simon Brunning wrote: > 2009/1/17 Michele Simionato : > > > "Expert Python Programming" by Tarek Ziadé is quite good and I wrote > > a review for it: > > >http://www.artima.com/weblogs/viewpost.jsp?thread=240415 > > +1 for this. I'm 3/4 of the way through it, it's pretty good.

Re: Python and threads

2009-01-19 Thread vedrandekovic
On 18 sij, 21:27, Stefan Behnel wrote: > [email protected] wrote: > > and thanks for all previous help.I want to measure memory usage of > > executed python script.I'am working on windows XP. > > Could you qualify "measure"? Do you mean: > > a) "debug" (permanently high accuracy, potentially

Receiving Output from os.system command

2009-01-19 Thread K-Dawg
I am really new to python and am trying to learn it to do some projects. I wanted to perform a simple task and am having some trouble with it. I run linux in a vm on a windows laptop for work. I have my laptop screen and an external monitor. I move my Ubuntu VM back and forth depending on what

Re: Python 2.6's multiprocessing lock not working on second use?

2009-01-19 Thread Nick Craig-Wood
Jesse Noller wrote: > > Opened issue #4999 [http://bugs.python.org/issue4999] on the matter, > > referencing this thread. > > Thanks, I've assigned it to myself. Hopefully I can get a fix put > together soonish, time permitting. Sounds like it might be hard or impossible to fix to me. I'd lov

Re: Receiving Output from os.system command

2009-01-19 Thread K-Dawg
Nevermind, I am an idiot. I didn't realize what it was returning... Please disregard. Thanks. Kevin On Mon, Jan 19, 2009 at 2:14 PM, K-Dawg wrote: > I am really new to python and am trying to learn it to do some projects. I > wanted to perform a simple task and am having some trouble with

Beginner Question

2009-01-19 Thread K-Dawg
Please forgive my beginner question. I have used python a little bit, mainly as a scripting language to perform specific administrative tasks. I have trying to learn to use it to develop applications but there are a few things I do not understand. I come from more of a Java background. I do no

Logging help

2009-01-19 Thread koranthala
Hi, Is it possible somehow to have the logging module rotate the files every time I start it. Basically, I can automatically rotate using RotatingFileHandler; Now I want it rotated every time I start the program too. Ex: The logging file - log.txt Now, rotatingfilehandler goes and updat

Re: Python 2.6's multiprocessing lock not working on second use?

2009-01-19 Thread Jesse Noller
On Mon, Jan 19, 2009 at 1:32 PM, Nick Craig-Wood wrote: > Jesse Noller wrote: >> > Opened issue #4999 [http://bugs.python.org/issue4999] on the matter, >> > referencing this thread. >> >> Thanks, I've assigned it to myself. Hopefully I can get a fix put >> together soonish, time permitting. > >

Re: Can I run an operation on an object's attribute when reading?

2009-01-19 Thread Bruno Desthuilliers
Chris Rebert a écrit : On Mon, Jan 19, 2009 at 4:22 AM, Phillip B Oldham wrote: On Mon, Jan 19, 2009 at 12:15 PM, Chris Rebert wrote: Assuming I'm interpreting you correctly (you're going to have to use something like a getter): Thanks, but I'm looking for a way to do it *without* using a ge

Re: string formatting documentation

2009-01-19 Thread John Machin
On Jan 20, 2:38 am, Alan G Isaac wrote: > But of more interest: you claim PEP 4 is not relevant, > and that old string formatting is NOT deprecated. > I would like assurance that it is not deprecated. It is not deprecated YET; see this: http://docs.python.org/3.0/whatsnew/3.0.html#changes-alread

Re: Can I run an operation on an object's attribute when reading?

2009-01-19 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : (snip) When all you have is a hammer, everything looks like a nail... Why do you have to read item.tags directly? Just write a function and call it instead of direct attribute access. A sensible advice, but only relevant if this class instances are only used by code

Re: uninstall before upgrade?

2009-01-19 Thread Scott David Daniels
waltbrad wrote: I want to upgrade from 2.5 to 2.6. Do I need to uninstall 2.5 before I do that? If so, what's the best way to uninstall it? Thanks. The answer to your question may depend on your operating system and setup. -- http://mail.python.org/mailman/listinfo/python-list

wsgi silently swallows errors

2009-01-19 Thread Ron Garret
Consider the following wsgi app: def application(env, start_response): start_response('200 OK',[('Content-type','text/plain')]) yield "hello" x=1/0 yield "world" The result of this is that the web browser displays "hello" and an error message ends up in the web log. But there is no othe

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Russ P.
On Jan 19, 7:13 am, Bruno Desthuilliers wrote: > I must be missing the point : if it's a public attribute, it doesn't > need a "property" ? I guess we use the same words for different things here. Yes, you are missing more than one point. Scala automatically converts public data members into pr

Re: Python and threads

2009-01-19 Thread Scott David Daniels
[email protected] said: > ... when I run these two threads, > I think they don't start at the same time In response, Diez B. Roggisch wrote: ... Even if you managed to get two threads started simultaneously (which the OS doesn't even offer IINM), the would soon run out of sync And th

Re: Beginner Question

2009-01-19 Thread Benjamin Kaplan
On Mon, Jan 19, 2009 at 2:39 PM, K-Dawg wrote: > Please forgive my beginner question. I have used python a little bit, > mainly as a scripting language to perform specific administrative tasks. I > have trying to learn to use it to develop applications but there are a few > things I do not unde

Re: psycopg2 weirdness

2009-01-19 Thread Yang Zhang
For posterity: the problem turned out to be a second request being made in quick succession by the client-side Javascript, causing the web.py request handler to run in multiple threads concurrently. The request handlers don't create their own Postgresql connections, but instead share one acros

Embedding Python. But not so easy.

2009-01-19 Thread Peter
Hi, Right now I am in a project writing a Simulation engine, and we are right now in the process of evaluating a script engine. The basic principle is a C++ engine simulating the environment and scriptable agents interacting with the environment. But the current design has a special requireme

Re: wsgi silently swallows errors

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

urllib2 httplib.BadStatusLine exception while opening a page on an Oracle HTTP Server

2009-01-19 Thread ak
Hi everyone, I have a problem with urllib2 on this particular url, hosted on an Oracle HTTP Server http://www.orange.sk/eshop/sk/portal/catalog.html?type=post&subtype=phone&null which gets 302 redirected to https://www.orange.sk/eshop/sk/catalog/post/phones.html, after setting a cookie through

Re: Regular expression that skips single line comments?

2009-01-19 Thread Steven D'Aprano
On Mon, 19 Jan 2009 08:08:01 -0800, martinjamesevans wrote: > I am trying to parse a set of files that have a simple syntax using RE. > I'm interested in counting '$' expansions in the files, with one minor > consideration. A line becomes a comment if the first non-white space > character is a sem

Re: Python Style Guide Questions - Contd.

2009-01-19 Thread Marc 'BlackJack' Rintsch
On Mon, 19 Jan 2009 05:50:54 -0800, koranthala wrote: > Hi, >I have some more questions about python code styling. 1. Global >Variables: In my code, I am using some global variables. > Now, when I ran PyLint, it raised convention errors mentioning that they > should be CAPITAL_ALPHABETS. N

PyQt4 on Windows ?

2009-01-19 Thread Linuxguy123
What does it take to get a PyQt4 application running on a Windows machine ? I'm sorry if this is a redundant question, but I've searched this and I am not finding a comprehensive answer. If anyone is running a PyQt4 application on a Windows (XP or Vista) machine, I'd love to know how it works for

Re: string formatting documentation

2009-01-19 Thread Steven D'Aprano
On Mon, 19 Jan 2009 15:38:02 +, Alan G Isaac wrote: > But of more interest: you claim PEP 4 is not relevant, and that old > string formatting is NOT deprecated. I would like assurance that it is > not deprecated. Can you back that? If you want to know what python-dev have in mind, you have to

Re: PyQt4 on Windows ?

2009-01-19 Thread Stephen Chapman
I have one running. actually use freezer to create an exe for it in windows. http://www.riverbankcomputing.co.uk/software/pyqt/download That will tell you how to get started. The app I wrote uses Pryro(with middleware server on a linux machine). And I use the standard widgets that qt has gri

Re: urllib2 httplib.BadStatusLine exception while opening a page on an Oracle HTTP Server

2009-01-19 Thread ak
On Jan 19, 10:00 pm, ak wrote: > Hi everyone, > > I have a problem with urllib2 on this particular url, hosted on an > Oracle HTTP Server > > http://www.orange.sk/eshop/sk/portal/catalog.html?type=post&subtype=p... > > which gets 302 redirected > tohttps://www.orange.sk/eshop/sk/catalog/post/phon

Re: string formatting documentation

2009-01-19 Thread Terry Reedy
Alan G Isaac wrote: On Mon, 19 Jan 2009 14:44:01 +, Alan G Isaac wrote: we are supposed to prefer No, no 'supposed to's. You are not even 'supposed to' like or use Python. (Unless, I supposed, an employer demands it. But that is another story.) Certainly, one is not 'supposed to' pre

Re: wsgi silently swallows errors

2009-01-19 Thread Graham Dumpleton
On Jan 20, 8:03 am, Jean-Paul Calderone wrote: > On Mon, 19 Jan 2009 12:15:29 -0800, Ron Garret wrote: > >Consider the following wsgi app: > > >def application(env, start_response): > >  start_response('200 OK',[('Content-type','text/plain')]) > >  yield "hello" > >  x=1/0 > >  yield "world" > >

Re: Beginner Question

2009-01-19 Thread Terry Reedy
K-Dawg wrote: I do no understand the underscore methods. Names of the form __xyx__ are defined by the language definition and recognized and used by the interpreter. See PythonLanguage / LexicalAnalysis / Identifiers / Reserved Most refer to methods, a few to other attributes. Modules may

Re: Ordering attributes for dynamically generated class

2009-01-19 Thread David Pratt
Hi Aaron, this worked out fine. Using an ordered dict to subclass dict. Many thanks. David On Jan 18, 2009, at 11:57 AM, Aaron Brady wrote: On Jan 18, 9:52 am, David Pratt wrote: Hi list. I use 'type' to generate classes but have a need to order the attributes for the generated class. Of cou

function to find the modification date of the project

2009-01-19 Thread Joe Strout
This isn't a question, but something I thought others may find useful (and if somebody can spot any errors with it, I'll be grateful). We had a case recently where the client was running an older version of our app, and didn't realize it. In other languages I've avoided this by displaying the

Re: tasklet library based on PEP 0342

2009-01-19 Thread Terry Reedy
[email protected] wrote: Using new features of python generators, as described in PEP 0342, it is possible to write some sort of "tasklets" in a maner very similar to stackless python, but running on cpython. For example : @tasklet def my_task(): yield Timer(10) yield "result" @task

Re: function to find the modification date of the project

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 7:44 AM, Joe Strout wrote: > This isn't a question, but something I thought others may find useful (and > if somebody can spot any errors with it, I'll be grateful). > > We had a case recently where the client was running an older version of our > app, and didn't realize it

Re: function to find the modification date of the project

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 8:39 AM, James Mills wrote: > On Tue, Jan 20, 2009 at 7:44 AM, Joe Strout wrote: >> This isn't a question, but something I thought others may find useful (and >> if somebody can spot any errors with it, I'll be grateful). >> >> We had a case recently where the client was r

Re: function to find the modification date of the project

2009-01-19 Thread MRAB
Joe Strout wrote: This isn't a question, but something I thought others may find useful (and if somebody can spot any errors with it, I'll be grateful). We had a case recently where the client was running an older version of our app, and didn't realize it. In other languages I've avoided this

Problem with IDLE on windows XP

2009-01-19 Thread Grimes, George
I am trying to learn Python and I installed version 2.6 both at home and at work. At home, on Vista, everything works fine. At work, on XP, IDLE would not run. I uninstalled/reinstalled and got the same thing. My cursor changes to the wait symbol for a few seconds, then goes back to normal a

Re: function to find the modification date of the project

2009-01-19 Thread Joe Strout
James Mills wrote: You know you could just store a __version__ attribute in your main library (__init__.py). :) What, and update it manually? I don't trust myself to remember to do that every time! Best, - Joe -- http://mail.python.org/mailman/listinfo/python-list

Re: function to find the modification date of the project

2009-01-19 Thread Joe Strout
James Mills wrote: Also I'd like to point out that your method is not very reliable as the modification time of those files could change at any moment. Consider unix systems for instnace where you could do: touch * And poof, you're modification times are now the current time! Yes, and presum

Re: python resource management

2009-01-19 Thread Terry Reedy
S.Selvam Siva wrote: Hi all, I am running a python script which parses nearly 22,000 html files locally stored using BeautifulSoup. The problem is the memory usage linearly increases as the files are being parsed. When the script has crossed parsing 200 files or so, it consumes all the availa

  1   2   >