FYI

2011-09-09 Thread Vito 'ZeD' De Tullio
http://scummos.blogspot.com/2011/09/kdev-python-argument-type-guessing.html I'm not used to big ide/rad for python... but I think this work is excellent! Are there alternatives (pydev? others?) capable of this sort of thinks (I mean "guessing the type" and method autocomplete) -- By ZeD --

Re: Processing a file using multithreads

2011-09-09 Thread Tim Roberts
Abhishek Pratap wrote: > >My application is not I/O bound as far as I can understand it. Each >line is read and then processed independently of each other. May be >this might sound I/O intensive as #N files will be read but I think if >I have 10 processes running under a parent then it might not b

Re: using python in web applications

2011-09-09 Thread Ben Finney
"Littlefield, Tyler" writes: > I'm curious if there are some good solutions for using Python in web > applications. Start with: http://docs.python.org/howto/webservers.html#frameworks> http://wiki.python.org/moin/WebFrameworks> and try your criteria against what you find there. -- \ “As

using python in web applications

2011-09-09 Thread Littlefield, Tyler
Hello all: I'm curious if there are some good solutions for using Python in web applications. I'm not feeling particularly masochistic, so I do not want to develop this project in PHP; essentially I'm looking to build a web-based MMO. I know that you can use nginx with Python with servers lik

Re: killing a script

2011-09-09 Thread Chris Angelico
On Sat, Sep 10, 2011 at 11:25 AM, Steven D'Aprano wrote: >>   This is implemented by calling the Standard C function system(), and >>   has the same limitations. >> >> and sure enough, "man 3 system" says: > > I don't consider having to look up documentation for a function in a > completely differ

Re: killing a script

2011-09-09 Thread Steven D'Aprano
Cameron Simpson wrote: > On 09Sep2011 22:16, Steven D'Aprano > wrote: > | Hans Mulder wrote: > | > On 9/09/11 11:07:24, Steven D'Aprano wrote: > | >> Sure enough, I now have to hit Ctrl-C repeatedly, once per invocation > | >> of script.py. While script.py is running, it receives the Ctrl-C, the

RE: Installing 2.6 on Win 7

2011-09-09 Thread ray
Brian,   Thank you, that was great.   Ray Joseph, PE832 586-5854r...@aarden.us      Original Message Subject: Re: Installing 2.6 on Win 7From: Brian Curtin Date: Fri, September 09, 2011 3:14 pmTo: ray Cc: python-list@python.orgOn Fri, Sep 9,

Re: IOError 35 when trying to read the result of call to urllib2.urlopen

2011-09-09 Thread Steven D'Aprano
matt wrote: > When I try to look at "resp_body" I get this error: > > IOError: [Errno 35] Resource temporarily unavailable > > I posted to the same URI using curl and it worked fine, so I don't > think it has to do with the server. Are your Python code and curl both using the same proxy? It may

Re: can't generate list from iterator [was: can't generate iterator from list]

2011-09-09 Thread Steven D'Aprano
Dr. Phillip M. Feldman wrote: > > It is supposed to be possible to generate a list representation of any > iterator that produces a sequence of finite length, but this doesn't > always work. Here's a case where it does work: > > Input: > > from itertools import combinations > list(combinations(

IOError 35 when trying to read the result of call to urllib2.urlopen

2011-09-09 Thread matt
I'm using urllib2's urlopen function to post to a service which should return a rather lengthy JSON object as the body of its response. Here's the code: {{{ ctype, body = encode_multipart(fields, files) url = 'http://someservice:8080/path/to/resource' headers = {'Content-Type': ctype, 'Content-Len

Re: can't generate iterator from list

2011-09-09 Thread Miki Tebeka
1. Can you post the code somewhere where it's indented properly? (http://paste.pocoo.org/) 2. In the list example you call balls_in_numbered_boxes(2, [3,3,3]) but in the interactive example you call balls_in_numbered_boxes(3,[3,3,3]) -- http://mail.python.org/mailman/listinfo/python-list

can't generate iterator from list

2011-09-09 Thread Dr. Phillip M. Feldman
It is supposed to be possible to generate a list representation of any iterator that produces a sequence of finite length, but this doesn't always work. Here's a case where it does work: Input: from itertools import combinations list(combinations(range(4),2)) Output: [(0, 1), (0, 2), (0, 3), (

Re: can't generate list from iterator

2011-09-09 Thread Dr. Phillip M. Feldman
The title should have been "can't generate list from iterator". -- View this message in context: http://old.nabble.com/can%27t-generate-iterator-from-list-tp32435519p32435569.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/

Re: killing a script

2011-09-09 Thread Cameron Simpson
On 09Sep2011 22:16, Steven D'Aprano wrote: | Hans Mulder wrote: | > On 9/09/11 11:07:24, Steven D'Aprano wrote: | >> Sure enough, I now have to hit Ctrl-C repeatedly, once per invocation of | >> script.py. While script.py is running, it receives the Ctrl-C, the | >> calling process does not. | >

Re: try... except with unknown error types

2011-09-09 Thread Stefan Krah
Chris Torek wrote: > (I have also never been sure whether something is going to raise > an IOError or an OSError for various OS-related read or write > operation failures -- such as exceeding a resource limit, for > instance -- so most places that do I/O operations on OS files, I > catch both. St

Re: Installing 2.6 on Win 7

2011-09-09 Thread Littlefield, Tyler
On 9/9/2011 2:04 PM, ray wrote: I have not found binaries for this install. The page http://www.python.org/download/windows/ takes me to http://www.python.org/download/releases/ which goes to http://www.python.org/download/releases/2.6.7/ Here are Gzip and Bzip tar balls. The readme files descr

Re: what's the command for (cd ..) in python

2011-09-09 Thread Littlefield, Tyler
On 9/9/2011 6:07 AM, kaustubh joshi wrote: Hello friends, How do we carry out the command "*cd ..*" in python? os.chdir, like so: >>> os.getcwd() '/home/tyler' >>> os.chdir("../") >>> os.getcwd() '/home' So you could do something like: os.chdir("../foo") My problem

Re: Installing 2.6 on Win 7

2011-09-09 Thread Benjamin Kaplan
On Sep 9, 2011 4:07 PM, "ray" wrote: > > I have not found binaries for this install. The page > http://www.python.org/download/windows/ > takes me to > http://www.python.org/download/releases/ > which goes to > http://www.python.org/download/releases/2.6.7/ > Here are Gzip and Bzip tar balls. Th

Re: Installing 2.6 on Win 7

2011-09-09 Thread Brian Curtin
On Fri, Sep 9, 2011 at 15:04, ray wrote: > > I have not found binaries for this install.  The page > http://www.python.org/download/windows/ > takes me to > http://www.python.org/download/releases/ > which goes to > http://www.python.org/download/releases/2.6.7/ > Here are Gzip and Bzip tar balls.

Installing 2.6 on Win 7

2011-09-09 Thread ray
I have not found binaries for this install. The page http://www.python.org/download/windows/ takes me to http://www.python.org/download/releases/ which goes to http://www.python.org/download/releases/2.6.7/ Here are Gzip and Bzip tar balls. The readme files describe linux builds and the content s

Re: what's the command for (cd ..) in python

2011-09-09 Thread Terry Reedy
On 9/9/2011 9:03 AM, Steven D'Aprano wrote: kaustubh joshi wrote: Hello friends, How do we carry out the command "*cd ..*" in python? import os os.chdir('..') But think carefully before doing this. Some functions may be confused if you change directories while they

A bit of a boggle about subprocess.poll() and the codes it receives from a process

2011-09-09 Thread J
Hi, I need a bit of help sorting this out... I have a memory test script that is a bit of compiled C. The test itself can only ever return a 0 or 1 exit code, this is explicitly coded and there are no other options. I also have a wrapper test script that calls the C program that should also onl

Re: TypeError: object.__init__() takes no parameters

2011-09-09 Thread Terry Reedy
On 9/9/2011 1:47 AM, Oliver wrote: If I want to run shapes.py I receive this error message: Others have explained why code that ran once now does not. class Container(object): """Container to store a number of non-overlapping rectangles.""" def __init__(self, xsize=1200, ysize=800

Re: Processing a file using multithreads

2011-09-09 Thread Abhishek Pratap
Hi All @Roy : split in unix sounds good but will it be as efficient as opening 10 different file handles on a file. I haven't tried it so just wondering if you have any experience with it. Thanks for your input. Also I was not aware of the python's GIL limitation. My application is not I/O boun

Re: How to structure packages

2011-09-09 Thread Alec Taylor
Kayode: Are the number of pages in that tutorial planned? :P > On Sat, Sep 10, 2011 at 1:57 AM, Kayode Odeyemi wrote: >> You might want to have a look at this: >> http://www.ccs.neu.edu/home/matthias/htdc.html >> >> On Fri, Sep 9, 2011 at 2:37 AM, Chris Angelico wrote: >>> >>> On Fri, Sep 9, 20

Re: Python and Outlook-style rules

2011-09-09 Thread Alec Taylor
Something like this? http://stackoverflow.com/questions/387606/using-user-input-to-find-information-in-a-mysql-database On Sat, Sep 10, 2011 at 12:29 AM, Brian wrote: > I'm about to create a system which will need to allow hundreds of > users to create and maintain their own rules in a similar f

Re: How to structure packages

2011-09-09 Thread Kayode Odeyemi
You might want to have a look at this: http://www.ccs.neu.edu/home/matthias/htdc.html On Fri, Sep 9, 2011 at 2:37 AM, Chris Angelico wrote: > On Fri, Sep 9, 2011 at 10:45 AM, Nobody wrote: > > The Java compiler also acts as a "make" program. If it doesn't find > > a .class file for a needed cla

Python and Outlook-style rules

2011-09-09 Thread Brian
I'm about to create a system which will need to allow hundreds of users to create and maintain their own rules in a similar fashion to MS Outlook rules. ie. Each rule consists of one or more user configurable conditions and if/ when the conditions are met then one or more user configurable actions

Re: TypeError: object.__init__() takes no parameters

2011-09-09 Thread Steven D'Aprano
Duncan Booth wrote: > Steven D'Aprano wrote: >> In Python 2.2, the default object constructor accepts, and ignores, any >> parameters. In Python 2.3 on up, that becomes an error. >> > More recently than that. It only became an error in 2.6: For __init__, sure, but it was an error for __new__ b

Re: TypeError: object.__init__() takes no parameters

2011-09-09 Thread Duncan Booth
Steven D'Aprano wrote: > Thomas Rachel wrote: > >> Am 09.09.2011 07:47 schrieb Oliver: >>> class Container(object): >>> """Container to store  a number of non-overlapping rectangles.""" >>> def __init__(self, xsize=1200, ysize=800): >>> super(Container, self).__init__(xsize, ysize) >> >> And t

Re: Processing a file using multithreads

2011-09-09 Thread Roy Smith
In article , aspineux wrote: > On Sep 9, 12:49 am, Abhishek Pratap wrote: > > 1. My input file is 10 GB. > > 2. I want to open 10 file handles each handling 1 GB of the file > > 3. Each file handle is processed in by an individual thread using the > > same function ( so total 10 cores are assu

Re: what's the command for (cd ..) in python

2011-09-09 Thread Steven D'Aprano
kaustubh joshi wrote: > Hello friends, > How do we carry out the command "*cd ..*" in > python? import os os.chdir('..') But think carefully before doing this. Some functions may be confused if you change directories while they are running. You may be better off staying

Re: what's the command for (cd ..) in python

2011-09-09 Thread Vlastimil Brom
2011/9/9 kaustubh joshi : > Hello friends, > How do we carry out the command "cd .." in python? > > My problem is : > I have a set of folders say m=1,2,3,4. In each of these folders, I have > subfolders with common name say m_5,m_6,m_7,m_8. In each of these subfolder, > the

Re: killing a script

2011-09-09 Thread Steven D'Aprano
Hans Mulder wrote: > On 9/09/11 11:07:24, Steven D'Aprano wrote: >> Sure enough, I now have to hit Ctrl-C repeatedly, once per invocation of >> script.py. While script.py is running, it receives the Ctrl-C, the >> calling process does not. > > You misinterpret what you are seeing: the calling pro

what's the command for (cd ..) in python

2011-09-09 Thread kaustubh joshi
Hello friends, How do we carry out the command "*cd ..*" in python? My problem is : I have a set of folders say m=1,2,3,4. In each of these folders, I have subfolders with common name say m_5,m_6,m_7,m_8. In each of these subfolder, there is a file which I have edit.

plz see this

2011-09-09 Thread ESTHU ESHU
http://123maza.com/65/clock747/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-09 Thread Chris Angelico
On Fri, Sep 9, 2011 at 9:04 PM, Peter Otten <__pete...@web.de> wrote: [x] = "" > Traceback (most recent call last): >  File "", line 1, in > ValueError: need more than 0 values to unpack [x] = "a" [x] = "ab" > Traceback (most recent call last): >  File "", line 1, in > ValueError:

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-09 Thread Peter Otten
Cameron Simpson wrote: > About the only time I do this is my personal "the()" convenience > function: > > def the(list, context=None): > ''' Returns the first element of an iterable, but requires there to be > exactly one. > ''' > icontext="expected exactly one value" >

Re: Create an index from a webpage [RANT, DNFTT]

2011-09-09 Thread Duncan Booth
Simon Cropper wrote: > Certainly doable but > considering the shear commonality of this task I don't understand why a > simple script does not already exist - hence my original request for > assistance. I think you may have underestimated the complexity of the task in general. To do it for a

Re: killing a script

2011-09-09 Thread Hans Mulder
On 9/09/11 11:07:24, Steven D'Aprano wrote: Sure enough, I now have to hit Ctrl-C repeatedly, once per invocation of script.py. While script.py is running, it receives the Ctrl-C, the calling process does not. You misinterpret what you are seeing: the calling process *does* receive the ctrl-C,

Re: Django or web2py

2011-09-09 Thread Vineet
On Sep 9, 12:47 pm, Vineet wrote: > On Sep 9, 3:29 am, Paul Watson wrote: > > > I have read some of the talk around these two frameworks. > > > Would you say that web2py is more geared toward the enterprise? > > > Which one do you believe will be on Python 3 more quickly? > > Both Django & web2py

Re: TypeError: object.__init__() takes no parameters

2011-09-09 Thread Duncan Booth
Thomas Rachel wrote: > Am 09.09.2011 07:47 schrieb Oliver: >> class Container(object): >> """Container to store a number of non-overlapping rectangles.""" >> def __init__(self, xsize=1200, ysize=800): >> super(Container, self).__init__(xsize, ysize) > > And this is the nonsen

Re: Portable locale usage

2011-09-09 Thread Laszlo Nagy
Why are you trying to force a specific locale to your program anyway? Because I wish to be able to correctly sort Croatian names. Well, all right. If you want to sort Croatian names from a program that runs on an English (or whatever) system, then you will have to check the platform and use a

Re: TypeError: object.__init__() takes no parameters

2011-09-09 Thread Thomas Rachel
Am 09.09.2011 10:33 schrieb Steven D'Aprano: Not nonsense. Merely a backward-incompatible change: [1] In Python 2.2, the default object constructor accepts, and ignores, any parameters. In Python 2.3 on up, that becomes an error. Thanks, I wasn't aware of that. My first contact with Pytho

Re: killing a script

2011-09-09 Thread Steven D'Aprano
Cameron Simpson wrote: > On 30Aug2011 14:13, Steven D'Aprano > wrote: > | On Tue, 30 Aug 2011 08:53 am Arnaud Delobelle wrote: > | >> Yes, but if I am not mistaken, that will require me to put a line or > | >> two after each os.system call. That's almost like whack-a-mole at the > | >> code level

Re: TypeError: object.__init__() takes no parameters

2011-09-09 Thread Steven D'Aprano
Thomas Rachel wrote: > Am 09.09.2011 07:47 schrieb Oliver: >> class Container(object): >> """Container to store  a number of non-overlapping rectangles.""" >> def __init__(self, xsize=1200, ysize=800): >> super(Container, self).__init__(xsize, ysize) > > And this is the nonsense: Container derive

Re: Django or web2py

2011-09-09 Thread Vineet
On Sep 9, 3:29 am, Paul Watson wrote: > I have read some of the talk around these two frameworks. > > Would you say that web2py is more geared toward the enterprise? > > Which one do you believe will be on Python 3 more quickly? Both Django & web2py are good frameworks. I have tried both of them

Unittesting SocketServer.StreamRequestHandler subclasses

2011-09-09 Thread Neilen Marais
Hi, Is there a recommended way for writing unittests of SocketServer.StreamRequestHandler subclasses? I've tried making a server stub class and a connection stub class with a recv() method that immediately raises socket.error(errno.ECONNRESET, ). This works OK, but it means that whatever unittest

Re: TypeError: object.__init__() takes no parameters

2011-09-09 Thread Thomas Rachel
Am 09.09.2011 07:47 schrieb Oliver: class Container(object): """Container to store a number of non-overlapping rectangles.""" def __init__(self, xsize=1200, ysize=800): super(Container, self).__init__(xsize, ysize) And this is the nonsense: Container derives from object and