Re: Too many threads

2010-09-16 Thread Ned Deily
In article <20100917052259.ga28...@cskk.homeip.net>, Cameron Simpson wrote: > On 16Sep2010 22:14, Ned Deily wrote: > | In article <20100917043826.ga21...@cskk.homeip.net>, > | Cameron Simpson wrote: > | > | > On 16Sep2010 09:55, mark.pellet...@asrcms.com > | > wrote: > | > | For some reason

Re: Too many threads

2010-09-16 Thread Cameron Simpson
On 16Sep2010 22:14, Ned Deily wrote: | In article <20100917043826.ga21...@cskk.homeip.net>, | Cameron Simpson wrote: | | > On 16Sep2010 09:55, mark.pellet...@asrcms.com | > wrote: | > | For some reason, the tasks I put into my thread pool occasionally get | > | run more than once. | > | | >

Re: Too many threads

2010-09-16 Thread Ned Deily
In article <20100917043826.ga21...@cskk.homeip.net>, Cameron Simpson wrote: > On 16Sep2010 09:55, mark.pellet...@asrcms.com > wrote: > | For some reason, the tasks I put into my thread pool occasionally get > | run more than once. > | > | Here's the code: > > You need to post your _exact_ co

Re: Too many threads

2010-09-16 Thread Cameron Simpson
On 16Sep2010 09:55, mark.pellet...@asrcms.com wrote: | For some reason, the tasks I put into my thread pool occasionally get | run more than once. | | Here's the code: You need to post your _exact_ code. I had to change: from queue import Queue into from Queue import Queue So: _do_ you have

Re: Very stupid question about a % symbol

2010-09-16 Thread Terry Reedy
On 9/16/2010 12:23 PM, J wrote: Thanks for the replies... I KNEW there was a simple way to escape the % but I had no idea what it was (I just had conviction). I was thrown when the \ didn't escape it... never knew about %%. But now I do! Thanks for the replies! Doubling an escape char, what

Re: The trouble with "dynamic attributes".

2010-09-16 Thread Terry Reedy
On 9/16/2010 5:46 PM, John Nagle wrote: By mistakenly posted this as a response to "compile Py2.6 on SL", you 1) confused the OP and 2) limited it audience -- I agree with your points, but would have missed this if I had had threads collapsed, as I usually do, since I have no interest in 2.6 co

Re: os.path.normcase rationale?

2010-09-16 Thread Nobody
On Thu, 16 Sep 2010 07:12:16 +1000, Ben Finney wrote: >> Yes, I know the behaviour is documented > > The docstring is fairly poor, IMO. You might want to submit a bug report > to improve it. The description in the library documentation is misleading: os.path.normcase(path) Normalize the cas

Re: os.path.normcase rationale?

2010-09-16 Thread Nobody
On Wed, 15 Sep 2010 14:49:09 +0100, Chris Withers wrote: > I'm curious as to why, with a file called "Foo.txt" > os.path.normcase('FoO.txt') will return "foo.txt" rather than "Foo.txt"? normcase() doesn't look at the filesystem; it's just string manipulation. -- http://mail.python.org/mailman

Re: The trouble with "dynamic attributes".

2010-09-16 Thread James Mills
On Fri, Sep 17, 2010 at 11:33 AM, moerchendiser2k3 wrote: > I am really sorry, but what are you talking about ? Hmmm, ...I have > problems to compile Python on SL, I did not ask anything about > "dynamic attribute". I don't get it... You are subscribed to the python mailing list. Check your subs

Re: WMI in Python

2010-09-16 Thread Lawrence D'Oliveiro
In message <257b2d99-03d4-491b-8f8b-dccd2bc10...@p22g2000pre.googlegroups.com>, alex23 wrote: > Lawrence D'Oliveiro wrote: > >> Why not just call Scriptomatic directly from within the Python script, >> then? > > Because Scriptomatic _generates scripts to access WMI_, that's what it > _does_. P

Re: The trouble with "dynamic attributes".

2010-09-16 Thread moerchendiser2k3
I am really sorry, but what are you talking about ? Hmmm, ...I have problems to compile Python on SL, I did not ask anything about "dynamic attribute". I don't get it... -- http://mail.python.org/mailman/listinfo/python-list

Re: File read from stdin and printed to temp file are not identicial?

2010-09-16 Thread James Mills
On Fri, Sep 17, 2010 at 10:25 AM, Jean Luc Truchtersheim wrote: > Dear Fellow python users, > > Many thanks for your help. > > Those missing brackets were the cause of my problem. > > Now my program works as expected. > > Many, many heartfelt thanks. Glad to hear it! Do you understand why ? chee

Re: File read from stdin and printed to temp file are not identicial?

2010-09-16 Thread Jean Luc Truchtersheim
Dear Fellow python users, Many thanks for your help. Those missing brackets were the cause of my problem. Now my program works as expected. Many, many heartfelt thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: data structure suggestion (native python datatypes or sqlite; compound select)

2010-09-16 Thread MRAB
On 17/09/2010 00:56, Vlastimil Brom wrote: 2010/9/17 MRAB: On 16/09/2010 23:11, Vlastimil Brom wrote: ... I put together some code, which works as expected, but I suspect somehow, that there must be better ways of doing it. Two things I am not quite clear about are using the placeholders for

Re: File read from stdin and printed to temp file are not identicial?

2010-09-16 Thread James Mills
On Fri, Sep 17, 2010 at 10:06 AM, MRAB wrote: > You're not closing f_in. That line should be: Although this _could_ be the problem (buffers not being flushed and the file being properly closed, etc) it could be something else... --James -- -- James Mills -- -- "Problems are solved by method" -

Re: File read from stdin and printed to temp file are not identicial?

2010-09-16 Thread James Mills
On Fri, Sep 17, 2010 at 9:36 AM, Jean Luc Truchtersheim wrote: > Can anybody reproduce this behavior. Jean it would help if you could provide samples of your input and output files. I'm pretty sure I might have a clue as to what your problem might be, but I can't be sure until I see the input and

Re: File read from stdin and printed to temp file are not identicial?

2010-09-16 Thread MRAB
On 17/09/2010 00:36, Jean Luc Truchtersheim wrote: Hello, I am trying to read from stdin and dump what's read to a temporary file. My code works for small files but as soon as I have a file that has, e.g., more than 300 lines, there is always one and only one line that is truncated compared to t

Re: File read from stdin and printed to temp file are not identicial?

2010-09-16 Thread Jason Swails
On Thu, Sep 16, 2010 at 7:36 PM, Jean Luc Truchtersheim < jeanluc...@gmail.com> wrote: > Hello, > > I am trying to read from stdin and dump what's read to a temporary > file. My code works for small files but as soon as I have a file that > has, e.g., more than 300 lines, there is always one and o

Re: data structure suggestion (native python datatypes or sqlite; compound select)

2010-09-16 Thread Vlastimil Brom
2010/9/17 MRAB : > On 16/09/2010 23:11, Vlastimil Brom wrote: >> >>... >> I put together some code, which works as expected, but I suspect >> somehow, that there must be better ways of doing it. >> >> Two things I am not quite clear about are using the placeholders for >> the data identifiers and "

File read from stdin and printed to temp file are not identicial?

2010-09-16 Thread Jean Luc Truchtersheim
Hello, I am trying to read from stdin and dump what's read to a temporary file. My code works for small files but as soon as I have a file that has, e.g., more than 300 lines, there is always one and only one line that is truncated compared to the input. Here is my code: #

Re: The trouble with "dynamic attributes".

2010-09-16 Thread James Mills
On Fri, Sep 17, 2010 at 9:27 AM, MRAB wrote: > For the work on updating the re module there was a discussion about > whether named capture groups should be available as attributes of the > match object or via subscripting (or both?). Subscripting seemed > preferable to me because: > > 1. Adding at

Re: The trouble with "dynamic attributes".

2010-09-16 Thread MRAB
On 16/09/2010 22:46, John Nagle wrote: There's a tendency to use "dynamic attributes" in Python when trying to encapsulate objects from other systems. It almost works. But it's usually a headache in the end, and should be discouraged. Here's why. Some parsers, like BeautifulSoup, try to encaps

Re: data structure suggestion (native python datatypes or sqlite; compound select)

2010-09-16 Thread MRAB
On 16/09/2010 23:11, Vlastimil Brom wrote: Hi all, I'd like to ask for suggestions regarding suitable datastracture for storing textual metadata along with a plain text string. The input format I have is simply text with custom tags like; I'd prefer to have this human readable format the original

Re: Deleting widgets from PyQt4 QFormWidget

2010-09-16 Thread David Boddie
On Wednesday 15 September 2010 18:53, Andrew wrote: > I'm trying to remove the widgets from the QFormLayout widget from > PyQt4. According to the documentation I should be able to use the > command .takeAt(int) which will delete the widget from the layout and > then return to me the QLayoutWidget.

data structure suggestion (native python datatypes or sqlite; compound select)

2010-09-16 Thread Vlastimil Brom
Hi all, I'd like to ask for suggestions regarding suitable datastracture for storing textual metadata along with a plain text string. The input format I have is simply text with custom tags like ; I'd prefer to have this human readable format the original data source. For the application, the tags

Re: The trouble with "dynamic attributes".

2010-09-16 Thread James Mills
On Fri, Sep 17, 2010 at 7:46 AM, John Nagle wrote: > There's a tendency to use "dynamic attributes" in Python when > trying to encapsulate objects from other systems.  It almost > works.  But it's usually a headache in the end, and should be > discouraged.  Here's why. What do you mean by "dynam

The trouble with "dynamic attributes".

2010-09-16 Thread John Nagle
There's a tendency to use "dynamic attributes" in Python when trying to encapsulate objects from other systems. It almost works. But it's usually a headache in the end, and should be discouraged. Here's why. Some parsers, like BeautifulSoup, try to encapsulate HTML tag fields as Python a

Re: socket.error: [Errno 98] Address already in use

2010-09-16 Thread björn lundin
> Where line 75 contains following: > s.bind((host, port)) As Tomas pointed out, you close conn, but you do not close the server socket 's' /Björn -- http://mail.python.org/mailman/listinfo/python-list

Re: Too much code - slicing

2010-09-16 Thread DataSmash
On Sep 16, 2:47 pm, Benjamin Kaplan wrote: > On Thu, Sep 16, 2010 at 3:35 PM, DataSmash wrote: > > I need to create a simple utility to remove characters from either the > > right or left side of directories. > > This works, but there has to be a better way.  I tried to use a > > variable inside

Re: Too much code - slicing

2010-09-16 Thread AK
On 09/16/2010 03:47 PM, Benjamin Kaplan wrote: On Thu, Sep 16, 2010 at 3:35 PM, DataSmash wrote: I need to create a simple utility to remove characters from either the right or left side of directories. This works, but there has to be a better way. I tried to use a variable inside the brackets

Re: Too much code - slicing

2010-09-16 Thread Benjamin Kaplan
On Thu, Sep 16, 2010 at 3:35 PM, DataSmash wrote: > I need to create a simple utility to remove characters from either the > right or left side of directories. > This works, but there has to be a better way.  I tried to use a > variable inside the brackets but I can't get > that to work.  Can anyo

Too much code - slicing

2010-09-16 Thread DataSmash
I need to create a simple utility to remove characters from either the right or left side of directories. This works, but there has to be a better way. I tried to use a variable inside the brackets but I can't get that to work. Can anyone think of a way to do this with less code? Thanks! import

Re: Problem building python 2.7 with --enable-shared

2010-09-16 Thread Marten Lehmann
I digged into this one step further: I compared the output of configure and make. For configure, there is no change. But for make, I found out something, that I didn't expected: When configure is called with a prefix to a location, where a valid python installation already exists, it uses the

Re: Problem building python 2.7 with --enable-shared

2010-09-16 Thread Marten Lehmann
The strange thing is: This only happens when I'm compiling through rpmbuild. Issuing the same commands (configure --enable-shared, make, make install) directly on the shell works fine... -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem building python 2.7 with --enable-shared

2010-09-16 Thread Thomas Jollans
On Thursday 16 September 2010, it occurred to Marten Lehmann to exclaim: > Hello, > > I've build python 2.7 successfully by just calling configure, make and > make install. But to use python within PostgreSQL, I need to built > python with --enable-shared. > > I tried to do so (configure --enable

Re: program organization question for web development with python

2010-09-16 Thread Iuri
Another pretty web framework is Bottle (http://bottle.paws.de). It is very easy to setup and use. I use it to tasks like this one you want. []s iuri On Thu, Sep 16, 2010 at 3:01 PM, MRAB wrote: > On 16/09/2010 18:19, Hans wrote: > >> On Sep 15, 5:33 pm, James Mills wrote: >> >>> On Thu, Sep 1

Re: program organization question for web development with python

2010-09-16 Thread MRAB
On 16/09/2010 18:19, Hans wrote: On Sep 15, 5:33 pm, James Mills wrote: On Thu, Sep 16, 2010 at 10:14 AM, Hans wrote: I'm new to this area. Please allow me to ask some (maybe stupid) questions. Without reading the rest of your post too much. Designs are up to you, I can't comment. I can on

Problem building python 2.7 with --enable-shared

2010-09-16 Thread Marten Lehmann
Hello, I've build python 2.7 successfully by just calling configure, make and make install. But to use python within PostgreSQL, I need to built python with --enable-shared. I tried to do so (configure --enable-shared), but I see these lines several times in the log (but compiling continues)

Re: program organization question for web development with python

2010-09-16 Thread Hans
On Sep 15, 5:33 pm, James Mills wrote: > On Thu, Sep 16, 2010 at 10:14 AM, Hans wrote: > > I'm new to this area. Please allow me to ask some (maybe stupid) > > questions. > > Without reading the rest of your post too much. Designs are up to you, > I can't comment. > > I can only share in a fairly

Too many threads

2010-09-16 Thread mark . pelletier
For some reason, the tasks I put into my thread pool occasionally get run more than once. Here's the code: # --- from threading import Thread from queue import Queue import subprocess

Re: socket.error: [Errno 98] Address already in use

2010-09-16 Thread cerr
On Sep 15, 11:58 am, Grant Edwards wrote: > On 2010-09-15, cerr wrote: > > > > > > > I get a socket error "[Errno 98] Address already in use" when i try to > > open a socket that got closed before with close(). How come close() > > doesn't close the socket properly? > > My socket code : > > >   s

Re: socket.error: [Errno 98] Address already in use

2010-09-16 Thread cerr
On Sep 15, 5:51 pm, "jipalaciosort...@gmail.com" wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > El 15/09/2010 20:58, Grant Edwards escribió: > > > > > On 2010-09-15, cerr wrote: > > >> I get a socket error "[Errno 98] Address already in use" when i > >> try to open a socket that got

Python 2.7 Won't Build

2010-09-16 Thread Tom Browder
I am trying to rebujild the 2.7 maintenance branch and get this error on Ubuntu 10.04.1 LTS: XXX lineno: 743, opcode: 0 Traceback (most recent call last): File "/usr/local/src/python-2.7-maint-svn/Lib/site.py", line 62, in import os File "/usr/local/src/python-2.7-maint-svn/Lib/os.py", li

Re: Very stupid question about a % symbol

2010-09-16 Thread Jason Swails
Ha, I had this same problem, but I was trying to do dynamic formatting: ("%%%s" % format) % number where "format" is a python-ized fortran format string (i.e. "9.4E"). Looks kinda weird and less elegant than the {0:{1}}-type .format() syntax, but at least it preserves backwards compatibility to

Re: Very stupid question about a % symbol

2010-09-16 Thread J
On Thu, Sep 16, 2010 at 12:09, Grant Edwards wrote: > On 2010-09-16, J wrote: > >> Reported memory amounts are within 10% tolerance > "Reported memory amounts are within %d%% tolerance" % 10 > 'Reported memory amounts are within 10% tolerance' Thanks for the replies... I KNEW there was a si

Re: Very stupid question about a % symbol

2010-09-16 Thread Tim Chase
On 09/16/10 10:25, J wrote: OK, this is a very stupid question about a very simple topic, but print "Reported memory amounts are within %s%s tolerance" % (self.mem_tolerance,'%') Is there a better way to print a '%' in the string when also using formating? I've tried things like this: print "b

Re: Very stupid question about a % symbol

2010-09-16 Thread Grant Edwards
On 2010-09-16, J wrote: > Reported memory amounts are within 10% tolerance >>> "Reported memory amounts are within %d%% tolerance" % 10 'Reported memory amounts are within 10% tolerance' -- Grant Edwards grant.b.edwardsYow! It's the RINSE CYCLE!!

Re: Very stupid question about a % symbol

2010-09-16 Thread Xavier Ho
On 17 September 2010 01:25, J wrote: > Is there a better way to print a '%' in the string when also using > formating? > I believe %% will escape the % and prints it straight out. Cheers, Xav -- http://mail.python.org/mailman/listinfo/python-list

Very stupid question about a % symbol

2010-09-16 Thread J
OK, this is a very stupid question about a very simple topic, but Google is failing me this morning... I'm trying to print a string that looks like this: Reported memory amounts are within 10% tolerance and the print line looks (for now) like this: print "Reported memory amounts are within %s%s

compile Py2.6 on SL

2010-09-16 Thread moerchendiser2k3
Hi, I have some trouble with Python on Snow Leopard (10.6.3). I compile Python as a framework(for 32/64bit) without any problems. But implementing the lib in my C app, I get the following error on linking: Undefined symbols: "_Py_InitModule4_64", referenced from: RegisterModule_BPY(char c

Stream Audio to Web Clients

2010-09-16 Thread AJ ONeal
I'm looking for an example (perhaps with red5) for this scenario: 1. I install some server tools on my ubuntu box 2. I place an mp3 and an m4a in a special location 3. I click a play button on a web page and both songs play in random order AJ ONeal -- http://mail.python.org/mailman/listinfo/pyth

Re: WMI in Python

2010-09-16 Thread KING LABS
On Sep 16, 12:39 pm, alex23 wrote: > Lawrence D'Oliveiro wrote: > > Why not just call Scriptomatic directly from within the Python script, then? > > Because Scriptomatic _generates scripts to access WMI_, that's what it > _does_. Are you _seriously_ advocating writing Python code to fire up > a W

Re: Multiprocessing Queue strange behavior

2010-09-16 Thread Bruno Oliveira
Hi, thanks for the answer. I thought about that, but the problem is that I found the problem in code that *was* using the Queue between processes. This code for example fails around 60% of the time in one of our linux machines (raising an Empty exception): from processing import Queue, Process im

Re: Python autocomplete module

2010-09-16 Thread Shashwat Anand
On Thu, Sep 16, 2010 at 5:34 PM, dusans wrote: > Is there a python module to make autocomplete suggestion easy. > Try 'rlcompleter' module. Though I haven't tried it myself, just used it in .pythonrc for auto-completion in intepretor mode. http://docs.python.org/library/rlcompleter.html -- ~l

Python autocomplete module

2010-09-16 Thread dusans
Is there a python module to make autocomplete suggestion easy. I would build an api reference as a string: CATALOG1.SCHEME1.TABLE1.column1 CATALOG1.SCHEME1.TABLE1.column2 CATALOG1.SCHEME1.TABLE1.column3 . . CATALOG10.SCHEME10.TABLE100.column1 CATALOG10.SCHEME10.TABLE100.column2 CATALOG10.SCHEME1

Re: Accessing windoze file attributes

2010-09-16 Thread Douglas
@Dave Grateful thanks for your web site suggestions, and I will look them up. @Lawrence Pleasee accept my apologies. I mistook your brevity for a superior snotty attitude. -- http://mail.python.org/mailman/listinfo/python-list

Re: accessing a text file

2010-09-16 Thread Baba
On Sep 9, 10:09 pm, Nobody wrote: > On Wed, 08 Sep 2010 03:30:00 -0700, Baba wrote: > > Who is licensed to judge what can and cannot be posted as a question? > > Exactly the same set of people who are licensed to judge what can and > cannot be posted as an answer. > > If you don't like the respons

Re: business date and calendar libraries?

2010-09-16 Thread Ian
On 13/09/2010 18:06, Chris Withers wrote: Hi All, I'm wondering what libraries people would use to answer the following questions relating to business days: - on a naive level; "what's give me the last business day" (ie: skipping weekends) - on a less-naive level; same question but taking

Re: Accessing windoze file attributes

2010-09-16 Thread Dave Angel
On 2:59 PM, Douglas wrote: @Diez and @David Thanks guys. Both excellent leads. Colour me happy. I can now make progress and meet some deadlines. :) @Lawrence Why reinvent rsync? In what way is rsync relevant to the stated problem? Did you actually READ the question? Note: I use Linux at hom

MAKE UPTO $5000 P/M $2000 IN FIRST 30 DAYS! NO INVESTMENT

2010-09-16 Thread superman
MAKE UPTO $5000 P/M $2000 IN FIRST 30 DAYS! NO INVESTMENT Generate $50 to $100 whenever you have a couple of hours free time to spare. You could make $50 or more in the next 2 hours. Starting right Now!Today! http://snipurl.com/11i6lw GET PAID TO: Take online surveys and make from $5 to $75, or

Re: WMI in Python

2010-09-16 Thread alex23
Lawrence D'Oliveiro wrote: > Why not just call Scriptomatic directly from within the Python script, then? Because Scriptomatic _generates scripts to access WMI_, that's what it _does_. Are you _seriously_ advocating writing Python code to fire up a Windows application, programmatically manipulati

Re: Argparse: add_argument with action=append appends to default

2010-09-16 Thread Peter Otten
John O'Hagan wrote: > I find this surprising: > import argparse parser = argparse.ArgumentParser() parser.add_argument('--test', action='append', default=['default']) > [...] parser.parse_args(['--test', 'arg']) > Namespace(test=['default', 'arg']) > > As an argument is provi

Re: select() call and filedescriptor out of range in select error

2010-09-16 Thread Steven D'Aprano
On Thu, 16 Sep 2010 15:51:38 +1000, James Mills wrote: > On Thu, Sep 16, 2010 at 2:49 PM, Ned Deily wrote: >> If the problem is that the socket object in question no longer exists, >> you can protect your code there by enclosing the remove operation in a >> try block, like: > > > The question t