Finding out what other tasks are running


Is there a cross-platform of determining what other processes (or in Windows terms, other applications) are running Is it possible in a cross-platform way to ask some other application to shut down, wait a while, and then test to see ...
Posted On: Saturday 10th of November 2012 04:30:46 AM Total Views:  110
View Complete with Replies

RELATED TOPICS OF Python Programming PROGRAMMING LANGUAGE




Need help finding a string in Python...

I'm trying to find certain keywords in Python, and insert all of the contents between the starting and ending keywords into the first declaration of the specific block. How would I do this I've been Googling, and can't find anything about it... :/
VIEWS ON THIS POST

76

Posted on:

Tuesday 25th September 2012
View Replies!

finding icons for Apps

This might be a dumb question. I don't know. I'm new to all this. How do you find icons for your programs GUI applications have cool icons that represent various things. For instance, to save is often represented as a disk, etc. You know, the small little picture references that give meaning to the phrase 'Graphical User Interface'. But I'm not a graphics artist! Drawing is simply one talent that skipped me completely. Where can I find icons to use with my programs I don't even know how to search for them, because I'm not sure how to word it. I tried Googling various things: icons, software graphics, application icons, custom graphics, etc, etc. But I'm not getting much luck here you . Also, besides just finding a collection of various pre-made icons, who would I talk to to make me some original custom made icons I'll look for hours and find one or two places, but they never respond to my messages, so I figure they must not do that kind of art work. I'm looking for both: a collection of graphics and some place (or someone) that can make custom original graphics. The latter is just for future reference. The more important one is the former, because I can't even afford to pay for originals right now. But maybe I will soon, so it would be nice to have a resource.
VIEWS ON THIS POST

101

Posted on:

Sunday 4th November 2012
View Replies!

Re: Python not finding modules

2008/2/13, Mani Chandra : > , >
VIEWS ON THIS POST

95

Posted on:

Sunday 4th November 2012
View Replies!

finding euclidean distance,better code?

hello while trying to write a function that processes some numpy arrays and calculate euclidean distance ,i ended up with this code (though i used numpy ,i believe my problem has more to do with python coding style..so am posting it here) .... # i am using these numpy.ndarrays to do the calculation facespace # of shape(totalimgs,imgpixels) weights # of shape(totalimgs,selectedfacespaces) input_wk # of shape(selectedfacespaces,) distance # of shape(selectedfacespaces,) initally all 0.0 's mindistance #of shape(selectedfacespaces,) initally all 0.0 's .... .... #here is the calculations part for image in range(numimgs): distance = abs(input_wk - weights[image, :]) if image==0: #copy from distance to mindistance mindistance=distance.copy() if sum(mindistance) > sum(distance): imgindex=image mindistance=distance.copy() if max(mindistance) > 0.0: #normalise mindistance mindistance=mindistance/(max(mindistance)+1) dist=sum(mindistance) this gets me the euclidean distance value.I want to know if the way i coded it can be improved,made more compact....if someone can give suggestions it will be a great help .
VIEWS ON THIS POST

141

Posted on:

Sunday 4th November 2012
View Replies!

finding items that occur more than once in a list

Is there a more efficient way to do this def f(L): '''Return a set of the items that occur more than once in L.''' L = list(L) for item in set(L): L.remove(item) return set(L) |>> f([0, 0, 1, 1, 2, 2, 3]) set([0, 1, 2])
VIEWS ON THIS POST

154

Posted on:

Sunday 4th November 2012
View Replies!

Re: deleting objects by finding all references and deleting?

"Jacob Davis" wrote in message news:C673A5C7-9971-4CAA-8CEB-3993C3E93F9C@gmail.com... | I read in some earlier messages that an object in Python is only | removed or freed from memory when all references to that object have | been deleted. Is this so A Python interpreter *may* delete an object when, but only when, it becomes inaccessible from the currently running program. What interpreters do depends on the interpreter. | If so, is there a way to get all of the references to an object, so | that they may all be deleted, thus actually deleting the object 'References' are implementation details, not Python objects. So while in CPython, sys.getrefcount(ob) returns a count, the meaning of 'get all references' is not obvious. So try to create, process, and delete objects as you go, and repeat for the next, instead of create all, process all, and delete all. For CPython, look at the gc module. tjr
VIEWS ON THIS POST

117

Posted on:

Sunday 4th November 2012
View Replies!

finding out the call (and not only the caller)

Today I've been thinking a bit about the "python internals". Inspired by this recipe: http://aspn.activestate.com/ASPN/Coo...n/Recipe/66062 I found out a little problem which haven't been able to solve. In short, is there a way to find out how a given name lookup was started It is not enough to know the name of the caller as given by the recipe. a little example: import inspect class test(object): def __init__(self, a_list): self.my_list = a_list def info(self): for counter, item in enumerate(inspect.getouterframes(inspect.currentframe())): print counter, item return self.my_list data = property(info) if __name__ == '__main__': a = test([1111,2222]) def g(a_seq): for item in a_seq: print item, '\n' g(a.data) This prints 0 (, 'myfile.py', 10, 'info', [' for counter, item in enumerate(inspect.getouterframes(inspect.currentframe())):\n'], 0) 1 (, 'myfile.py', 38, '', [' g(a.data)\n'], 0) 1111 2222 What I would like is a reference to g itself, and not only to '' which is the caller according to f_code.co_name. I thought of manually parsing the string ' g(a.data)\n' to extract the name but I'm sure that it would be a rather fragile approach, and so I decided that it was time to ask for help :-) To 'get a feeling', I tried to disassemble the code: code = compile('g(a.data)', 'test', 'single') dis.dis(code) and this is the result 0 LOAD_NAME 0 (g) 3 LOAD_NAME 1 (a) 6 LOAD_ATTR 2 (data) 9 CALL_FUNCTION 1 12 PRINT_EXPR 13 LOAD_CONST 0 (None) 16 RETURN_VALUE So ... I'm looking for the first name loaded. Is there a reference to it, somewhere Francesco
VIEWS ON THIS POST

234

Posted on:

Monday 5th November 2012
View Replies!

Re: iterating over the other and finding the greatest

> have carry out a process a>b then i should print the line and if b>c then i > should print the line and c>d then i should print....... like this i have to > continue.say for eg: 43 98 so i can print the line second row... > my code: > fh = open('364010_spacing','r') > for lines in fh.readlines(): > data = lines.strip().split('\t') > start =data[0].strip() > end = data[1].strip() > values = data[2].strip() > id = data[3].strip() > if a > b :#hanged up here > print lines though you don't really define a/b/c anywhere, other than obliquely referencing values in your 3rd column, I presume they map to the lines in the file a=1st-line, b=2nd-line, etc. You also don't disclose when you want the printing to happen, whether you want to print the highest at each line as you iterate over them (in your example, printing a,b,b,b,e,e,e,e or if you want to find the maximum and then print it at the end (just printing line e once). I don't know if you want to do if more than one row has the maximum value. Do you want to print all of the matching lines or just the first or last one encountered The code below iterates over the file, finding the maximum of the 3rd column, and then printing the first line that matched that. for i,line enumerate(open(filename, 'r')): c = int(line.rstrip('\n').split('\t')[2]) if i == 0: highest_id = c best_match = line else: if c > highest_id: highest_id = c best_match = line print line In your code, you parsed start/end, but didn't use them for anything...vestigial code -tkc
VIEWS ON THIS POST

136

Posted on:

Monday 5th November 2012
View Replies!

Cross platform way of finding number of processors on a machine?

Is there a way to find the number of processors on a machine (on linux/ windows/macos/cygwin) using python code (using the same code/cross platform code)
VIEWS ON THIS POST

135

Posted on:

Monday 5th November 2012
View Replies!

Re: finding an element in a string

On Mon, Jun 25, 2007 at 04:09:50PM -0400, Miguel Oliveira wrote: > But that, obviously, will only respond "good" when one writes "fine". I was > looking for a way for the program to respond "good" to any sentence that would > contain the word "fine" in it. What you want is a regular-expression match. Are you familiar with regexes The relevant Python documentation is here (for the module 're'): http://docs.python.org/lib/module-re.html though I find it's not particularly easy reading. The Friedl book recommended in there is the canonical source about regexes, and it is indeed a great book. You should read some manpages first, though. Just google for 'regular expressions' and you'll find all that you need. In the meantime, what you want is something like if re.search( r'fine', x ): # things one does if the user said 'fine' Alternately, you could just use rfind(): http://docs.python.org/lib/string-methods.html but regexes are a good tool to get to know. They're overused (particularly in Perl), but this is just the sort of task they're good for. -- Stephen R. Laniel steve@laniels.org Cell: +(617) 308-5571 http://laniels.org/ PGP key: http://laniels.org/slaniel.key
VIEWS ON THIS POST

166

Posted on:

Monday 5th November 2012
View Replies!

Re: finding an element in a string

On 6/25/07, Miguel Oliveira wrote: > I was looking for a way for the program to respond "good" to any sentence > that would contain the word "fine" in it. This will work for any string with the string "fine" in it. if "fine" in x: print "Good." -- Jerry
VIEWS ON THIS POST

133

Posted on:

Monday 5th November 2012
View Replies!

finding domain name

hi group. I'm new to python and need some help and hope you can answer this question. I have a situation in my code where i need to create a file on the server and write to it. That's not a problem if i hard code the path. However, the domain name needs to be dynamic so it is picked up automatically. The path to our websites is home/sites/xxxxx/ where xxxxx represents the domain name. How can I find the domain name of the current url being viewed.
VIEWS ON THIS POST

116

Posted on:

Wednesday 7th November 2012
View Replies!

finding out the number of rows in a CSV file

anyone know how I would find out how many rows are in a csv file I can't find a method which does this on csv.reader.
VIEWS ON THIS POST

104

Posted on:

Wednesday 7th November 2012
View Replies!

Re; finding euclidean distance,better code?

On Saturday 29 March 2008 03:09:46 Steven D'Aprano wrote: > On Fri, 28 Mar 2008 16:59:59 +0100, Robert Bossy wrote: > > Gabriel Genellina wrote: > >> That's what I said in another paragraph. "sum of coordinates" is using > >> a different distance definition; it's the way you measure distance in a > >> city with square blocks. I don't know if the distance itself has a > >> name, but > > > > I think it is called Manhattan distance in reference of the walking > > distance from one point to another in this city. > > You know, there are other cities than Manhattan. Some of them even have > streets and blocks. Sorry about having to dispel your illusions, but - In Printed Circuit Board Layout jargon, the 'manhattan distance' is the sum of the distances along the orthogonal axes between two points on the board that should be connected. The sum of all such distances is an idealised minimum for the total track length on a double sided board, given that it were possible to lay all tracks with segments connected by vias, making strictly increasing progress in the deed direction, by laying x direction tracks on the one, and y direction tracks on the other side of the board without having to "backtrack" - i.e. having to "dodge around" obstacles, thereby adding "overshooting" segments of track. (A via is a through plated hole that connects copper traces or tracks on opposite sides of the board) So I have met the beast, but I have no concept of its origin, other than the mind numbing regularity of the layout of the suburb of the city after which it seems to be named - For all I know 'manhatten' could be a native american word that means "net". Have you noticed that when people say "Sorry.....but...." they are not normally sorry at all :-) - Hendrik
VIEWS ON THIS POST

109

Posted on:

Wednesday 7th November 2012
View Replies!

Clone Digger: the tool for finding software clones; GSoC 2008

. I am glad to present you Clone Digger, the tool for finding software clones in Python programs, The presence of clones can greatly increase the software maintenance cost. For instance, every error in the original have to be fixed in all copies. Therefore I hope that Clone Digger will be useful for the Python community. It can help to form recommendations for refactoring. Clone Digger works on the abstract syntax tree level. You can read more about Clone Digger, see examples and download it on the page: http://clonedigger.sourceforge.net . ======= Google Summer of Code 2008 ======= Clone Digger participates in the Google Summer of Code 2008 program. I think, that Clone Digger will be a good choice for students willing *) to learn about the structure of programs written in Python, *) to practice in designing and implementing new algorithms (you will be asked to add automatic refactoring feature) *) to develop the tool which will help people to create better programs You can see the project ideas here: http://clonedigger.sourceforge.net/g...r_of_code.html Please, fill free to ask me any questions you may have. -- Best regards, Peter Bulychev.
VIEWS ON THIS POST

129

Posted on:

Wednesday 7th November 2012
View Replies!

Clone Digger: the tool for finding software clones;Google Summer of Code 2008 participant

I'm happy to announce the first release of Clone Digger tool (1.0-beta). Some background on software clones ====================== Two continuous fragments of code form clone if they are similar enough. The presence of clones can greatly increase the software maintenance cost. For instance, every error in the original have to be fixed in all copies. What is it ====================== Clone Digger is the tool for finding software clones (duplicate code) in programs. Currently Python language is supported, Java support will be added later. The following definition of clone is used: two sequences of statements form clone if one of it can be obtained from the other by replacing some subtrees of its abstract syntax tree by other subtrees. Found clone candidates are reported to the HTML with a highlighting of differences. This report can be used to form recommendations for refactoring. License ====================== Clone Digger is provided under the GPL license. Links ====================== Project site: http://clonedigger.sourceforge.net Download: http://clonedigger.sourceforge.net/download.html Clone Digger was tested on Python 2.4 and 2.5. To my knowledge Clone Digger is the first tool that finds software clones in Python sources (excluding tools working on the pure text level). I hope that Clone Digger will be very useful for the Python community. p.s. Clone Digger participates in the Google Summer of Code 2008 program. I am looking for a student willing to work on code ****ysis and refactoring. The project ideas are listed here: http://clonedigger.sourceforge.net/g...r_of_code.html Clone Digger 1.0-beta - the tool for finding software clones in Python programs. (23-March-2008) -- Best regards, Peter Bulychev.
VIEWS ON THIS POST

122

Posted on:

Wednesday 7th November 2012
View Replies!

Python not finding modules

! I installed a few python modules through the freebsd ports, but when I try to import them in the interpreter it says "module xxx not found". This seems to happen for some modules and not for the others. ex:- I installed psyco and parallel python which seem to be found but then scipy, PIL aren't being imported. Below is my $PYTHONPATH ['', '/usr/local/lib/python2.5/site-packages/setuptools-0.6c7-py2.5.egg', '/usr/local/lib/python25.zip', '/usr/local/lib/python2.5', '/usr/local/lib/python2.5/plat-freebsd6', '/usr/local/lib/python2.5/lib-tk', '/usr/local/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/usr/local/lib/python2.5/site-packages/gtk-2.0', '/usr/local/lib/vtk/python', '/usr/local/lib/python2.5/site-packages'] The scipy libs are located at "/usr/local/lib/python2.4/site-packages/scipy" so I manually added this path to the PYTHONPATH but it still doesn't seem to find it. Can someone please help me out here ps Also does including a directory in PYTHONPATH include all of it's sub-directories too Download prohibited No problem. CHAT from any browser, without download. Go to http://in.messenger.yahoo.com/webmessengerpromo.php/
VIEWS ON THIS POST

104

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Python not finding modules

2008/2/13, Mani Chandra : > ! > I installed a few python modules through the freebsd ports, but when I try to import them in the interpreter it says "module xxx not found". This seems to happen for some modules ...
VIEWS ON THIS POST

117

Posted on:

Saturday 10th November 2012
View Replies!

Gluon 1.15 is out

everybody, Gluon 1.15 is out. This is a free open source framework for agile development of secure database driven web applications, written in Python, programmable in Python. Stable API and supported since October 1st 2007. http://mdp.cti.depaul.edu http://www.vimeo.com/428474 (video tutorial) ...
VIEWS ON THIS POST

31

Posted on:

Saturday 10th November 2012
View Replies!

Question about email-handling modules

, I'm new to Python but have lots of programming experience in C, C++ and Perl. Browsing through the docs, the email handling modules caught my eye because I'd always wanted to write a script to handle my huge, ancient, ...
VIEWS ON THIS POST

80

Posted on:

Saturday 10th November 2012
View Replies!