RE: subprocess.Popen and thread module

2011-08-09 Thread Danny Wong (dannwong)
Hi Chris, Here is the code, try: cmd_output = subprocess.Popen(['scm', 'load', '--force', '-r', nickname, '-d', directory, project], stdout=subprocess.PIPE, stderr=subprocess.PIPE) status = cmd_output.wait() print "In load status is: %s" % status + "\n" except:

Re: subprocess.Popen and thread module

2011-08-09 Thread Chris Rebert
On Tue, Aug 9, 2011 at 11:38 PM, Danny Wong (dannwong) wrote: > Hi All, >   I'm trying to execute some external commands from multiple database. > I'm using threads and subprocess.Popen ( from docs, all the popen* > functions are deprecated and I was told to use subprocess.Popen) to > execute the

subprocess.Popen and thread module

2011-08-09 Thread Danny Wong (dannwong)
Hi All, I'm trying to execute some external commands from multiple database. I'm using threads and subprocess.Popen ( from docs, all the popen* functions are deprecated and I was told to use subprocess.Popen) to execute the external commands in parallel, but the commands seems to hang. My quest

Re: allow line break at operators

2011-08-09 Thread Yingjie Lan
On Tue, Aug 9, 2011 at 9:42 PM, Yingjie Lan wrote: > Hi all, > > When writing a long expresion, one usually would like to break it into > multiple lines. Currently, you may use a '\' to do so, but it looks a little > awkward (more like machine-oriented thing). Therefore I start wondering why >

Re: allow line break at operators

2011-08-09 Thread Chris Rebert
On Tue, Aug 9, 2011 at 9:42 PM, Yingjie Lan wrote: > Hi all, > > When writing a long expresion, one usually would like to break it into > multiple lines. Currently, you may use a '\' to do so, but it looks a little > awkward (more like machine-oriented thing). Therefore I start wondering why >

allow line break at operators

2011-08-09 Thread Yingjie Lan
Hi all, When writing a long expresion, one usually would like to break it into multiple lines. Currently, you may use a '\' to do so, but it looks a little awkward (more like machine-oriented thing). Therefore I start wondering why not allow line breaking at an operator, which is the standard w

multiprocessing timing issue

2011-08-09 Thread Tim Arnold
Hi, I'm having problems with an empty Queue using multiprocessing. The task: I have a bunch of chapters that I want to gather data on individually and then update a report database with the results. I'm using multiprocessing to do the data-gathering simultaneously. Each chapter report gets put

Re: input file format

2011-08-09 Thread Steven D'Aprano
On Wed, 10 Aug 2011 01:00 pm Etay wrote: > Is there some simple way to skip over the lines I don't need, and then > inform Python about the format of the lines with the data I do need > within a loop? Yes. It's called "programming" :) f = open('some file') for line in f: if some_condition(li

input file format

2011-08-09 Thread Etay
Hi all, I am trying to write a Python script which will read the output file of a numerical model, and then copy some of that information into a new file in a new format. The output file of the numerical model is basically 54321 # number of points 1234 # number of time steps __a whole bunch of

Re: just for fun: make a class (not its instances) iterable

2011-08-09 Thread Terry Reedy
On 8/9/2011 8:29 PM, Tim Chase wrote: On 08/09/2011 07:11 PM, Terry Reedy wrote: On 8/9/2011 5:43 PM, Gelonida N wrote: Now I wondered whether there is any way to implement a class such, that I can write for val in MyClass: print val And what are the items in a class that you expect that to

Re: just for fun: make a class (not its instances) iterable

2011-08-09 Thread Tim Chase
On 08/09/2011 07:11 PM, Terry Reedy wrote: On 8/9/2011 5:43 PM, Gelonida N wrote: Now I wondered whether there is any way to implement a class such, that I can write for val in MyClass: print val And what are the items in a class that you expect that to produce? I can see doing som

Re: numpy/scipy: calculate definite integral of sampled data

2011-08-09 Thread Terry Reedy
numpy/scipy questions are best asked on the numpy/scipy user lists. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: just for fun: make a class (not its instances) iterable

2011-08-09 Thread Terry Reedy
On 8/9/2011 5:43 PM, Gelonida N wrote: Now I wondered whether there is any way to implement a class such, that I can write for val in MyClass: print val And what are the items in a class that you expect that to produce? I am pretty sure you can already do for val in MyClass.__dict__

Re: just for fun: make a class (not its instances) iterable

2011-08-09 Thread Steven D'Aprano
Gelonida N wrote: > Now I wondered whether there is any way to implement a class such, that > I can write > > > for val in MyClass: > print val One way to make an object iterable (there are others) is to add an __iter__ method to the object's class. Unlike in some languages, classes in Pyth

ANNOUNCING GOZERBOT 0.9.3 BETA1

2011-08-09 Thread Bart Thate
Hi world and every living thing on it ! I just want to give a headsup to the fact that i released the first beta of GOZERBOT 0.9.3. This release brings in a lot of bug fixes, so please try it out ;] Download is at http://gozerbot.googlecode.com, please if you find problems with the bot file a tic

Re: Complex sort on big files

2011-08-09 Thread John Nagle
On 8/6/2011 10:53 AM, sturlamolden wrote: On Aug 1, 5:33 pm, aliman wrote: I've read the recipe at [1] and understand that the way to sort a large file is to break it into chunks, sort each chunk and write sorted chunks to disk, then use heapq.merge to combine the chunks as you read them. Or

Re: just for fun: make a class (not its instances) iterable

2011-08-09 Thread Chris Kaynor
You can using metaclasses (untested): >>>class MyMetaClass(type): >>>def __iter__(self): >>>return [1, 2, 3, 4] >>>class MyClass(object): >>>__metaclass__ = MyMetaClass >>>for value in MyClass: >>>print value 1 2 3 4 Chris On Tue, Aug 9, 2011 at 2:43 PM, Gelonida N wrote:

Re: What's in a name?

2011-08-09 Thread Ron
On Aug 1, 10:11 am, Andrew Berg wrote: > Hmm > How about Rainbow Video Encoder Wrapper (Rainbow View for short - RView > is taken, possibly multiple times)? > I added an arbitrary word to a generic name, and the result doesn't seem > to be taken by anything software-related. It wraps more than

just for fun: make a class (not its instances) iterable

2011-08-09 Thread Gelonida N
Hi, I am just curious. There is no real use case: If I have a class and I want that its instances are iterable I can just add a class metohod named __iter__() example: class MyClass(object): def __iter__(self): for val in range(10): yield val

Re: __all__

2011-08-09 Thread Paul Woolcock
The gurus will have to correct me if this is not an accepted practice, but I know some projects (Fabric is the one that comes to mind) will define a submodule specifically for the 'from blah import *' situation. The submodule would be called "api", or something like that, so you can do: 'from mymod

RE: Passing every element of a list as argument to a function

2011-08-09 Thread Prasad, Ramit
-Original Message- From: python-list-bounces+ramit.prasad=jpmorgan@python.org [mailto:python-list-bounces+ramit.prasad=jpmorgan@python.org] On Behalf Of Antonio Vera Sent: Tuesday, August 09, 2011 12:02 PM To: python-list@python.org Subject: Passing every element of a list as argu

Re: Object Diffs

2011-08-09 Thread Irmen de Jong
On 08-08-11 21:50, Croepha wrote: Hello Python list: I am doing research into doing network based propagation of python objects. In order to maintain network efficiency. I wan't to just send the differences of python objects, I was wondering if there was/is any other research or development in

Re: Passing every element of a list as argument to a function

2011-08-09 Thread Chris Angelico
On Tue, Aug 9, 2011 at 6:02 PM, Antonio Vera wrote: > Hi!, > I have a very simple syntax question. I want to evaluate a library > function f receiving an arbitrary number of arguments (like > itertools.product), on the elements of a list l. This means that I > want to compute f(l[0],l[1],...,l[len

Passing every element of a list as argument to a function

2011-08-09 Thread Antonio Vera
Hi!, I have a very simple syntax question. I want to evaluate a library function f receiving an arbitrary number of arguments (like itertools.product), on the elements of a list l. This means that I want to compute f(l[0],l[1],...,l[len(l)-1]). Is there any operation "op" such that f(op(l)) will g

numpy/scipy: calculate definite integral of sampled data

2011-08-09 Thread Manuel Graune
Hi everyone, to calculate the definite integral of a function or an array of sampled data scipy provides (among others) the quad and trapz functions. So it is possible to compute e. g. the definite integral of cos(t) over some range by doing definite_integral= scipy.integrate.quad(cos,lower_limit

Re: __all__

2011-08-09 Thread Steven D'Aprano
Ethan Furman wrote: > Greetings! > > Does anyone know/recall the original purpose of __all__? To customise the names available for `from ... import *`: http://docs.python.org/whatsnew/2.1.html#other-changes-and-fixes > I had thought it was primarily to specify what would be imported when > `f

__all__

2011-08-09 Thread Ethan Furman
Greetings! Does anyone know/recall the original purpose of __all__? I had thought it was primarily to specify what would be imported when `from ... import *` was executed, such as for tk; today, it seems it is also used to specify the API for the module, and so the help() subsystem will only

Re: How to solve this problem

2011-08-09 Thread Ulrich Eckhardt
Johny wrote: > I have a client that is a part of a local network.This client has a > local address( not public).Is there a way how I can connect to this > client from outside world? > What software must I install so that I can connect and control that > client from outside? How is that a Python p

Re: How to solve this problem

2011-08-09 Thread John Gordon
In <81a681e7-0be1-4edc-9e27-b492e8b63...@a17g2000yqk.googlegroups.com> Johny writes: > I have a client that is a part of a local network.This client has a > local address( not public).Is there a way how I can connect to this > client from outside world? When you say the client's address is "no

Re: os.path.dirname(sys.argv[0]) always returns nothing

2011-08-09 Thread WaffleSouffle
On Aug 2, 12:57 am, Gregory Ewing wrote: > Thijs Engels wrote: > > argv[0] returns the name of the current file (string), but no path > > information if I recall correct. > > It's the path that was used to specify the script by whatever > launched it, so it could be either absolute or relative to

Re: [Swig-user] Segmentation Fault on exit

2011-08-09 Thread Stefan Zager
On Sat, Aug 6, 2011 at 3:35 AM, Vipul Raheja wrote: > Hi, > > I have wrapped a library from C++ to Python using SWIG. But when I > import it in Python, I am able to work fine with it, but it gives a > segmentation fault while exiting. Following is the log: > > vipul@vipul-laptop:~/ossim-svn/src/py

Re: How to solve this problem

2011-08-09 Thread Katriel Cohn-Gordon
Unless you have the router configured to allow connections through to your local client, you will need the client to connect *outwards*, either to you or to an intermediate server. On Tue, Aug 9, 2011 at 12:10 PM, Johny wrote: > I have a client that is a part of a local network.This client has

How to solve this problem

2011-08-09 Thread Johny
I have a client that is a part of a local network.This client has a local address( not public).Is there a way how I can connect to this client from outside world? What software must I install so that I can connect and control that client from outside? Thanks B -- http://mail.python.org/mailman/

Re: WxPython and TK

2011-08-09 Thread gb
azrael writes: > OK, now. Isn't it maybe time to throw out TK once and for all? no, because Tk has a clear advantage over many other UI tolkits Tk _was designed_ and it was designed by very competent people [1] good luck with smurfs' hunting [2], ciao

Re: Need help with Python to C code compiler

2011-08-09 Thread Chris Angelico
On Tue, Aug 9, 2011 at 6:37 AM, Vijay Anantha Murthy wrote: > My main impediment here is writing out the C code manually myself, my C > skills are quite poor and it would require a huge effort to sharpening my > C skills before writing the code myself, I can not afford that luxury of > time. Writ

Re: Need help with Python to C code compiler

2011-08-09 Thread Stefan Behnel
Vijay Anantha Murthy, 09.08.2011 07:37: Is there any compiler which will help me convert my python code to proper C code? In my python code I am using the XML.dom.minidom module to parse an xml and process the results obtained by ElementsByTagName. I don't know of any such compiler which will hel