notify when process finishes (on unix)

2007-09-30 Thread bahoo
Hi, I'd like to write a script that sends me an email when a unix (Linux) process ends running (or CPU drops below some threshold). Could anyone point me to the relevant functions, or show me an example? Thanks bahoo -- http://mail.python.org/mailman/listinfo/python-list

subprocess.Popen fails, but os.system works

2007-04-24 Thread bahoo
write) File "C:\Python25\lib\subprocess.py", line 793, in _execute_child startupinfo) WindowsError: [Error 22] The filename, directory name, or volume label syntax is incorrect --- Can anyone tell me why? Thanks bahoo -- http://mail.python.org/mailman/listinfo/python-list

recursively archiving files

2007-04-09 Thread bahoo
Hi, Can I use python to recursively compress files under subdirectories with a certain format such as "ABC_XXX_XXX.dat" into a .gz or .zip file? I used to do it with "tar" on unix, but I don't like to put commands into a single line, as it is often more prone to error

recursively removing files and directories

2007-04-09 Thread bahoo
ion to the Jan 16 2006 message required many lines of python code. I was wondering if there is a simpler solution to my problem at hand, perhaps by using more specialized functions? Thanks! bahoo -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remove multiple occurrences of a string within a list?

2007-04-03 Thread bahoo
On Apr 3, 6:05 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > bahoo wrote: > > The larger problem is, I have a list of strings that I want to remove > > from another list of strings. > > If you don't care about the resulting order:: > > >>

Re: how to remove multiple occurrences of a string within a list?

2007-04-03 Thread bahoo
On Apr 3, 3:01 pm, "7stud" <[EMAIL PROTECTED]> wrote: > On Apr 3, 12:20 pm, "bahoo" <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I have a list like ['0024', 'haha', '0024'] > > and as output I want ['haha&

Re: how to remove multiple occurrences of a string within a list?

2007-04-03 Thread bahoo
On Apr 3, 4:21 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > bahoo wrote: > > On Apr 3, 2:31 pm, "Matimus" <[EMAIL PROTECTED]> wrote: > >> It depends on your application, but a 'set' might really be what you > >> want, as opposed to

How to check if OS is unix or pc

2007-04-03 Thread bahoo
In Matlab, there is a "isunix" command. Is there something similar in python? Thanks! bahoo -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help on reading line from file into list

2007-04-03 Thread bahoo
On Apr 3, 5:06 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > bahoo a écrit : > > > Hi, > > > I have a text file containing a single line of text, such as > > 0024 > > > How should I read it into a "list"? > > You mean ['0024

Need help on reading line from file into list

2007-04-03 Thread bahoo
Hi, I have a text file containing a single line of text, such as 0024 How should I read it into a "list"? I tried this, but the "join" did not work as expected. Any suggestions? infile = open('my_file.txt','r') for line in infile: line.join(line) my_list.extend( line ) -- http

Re: how to remove multiple occurrences of a string within a list?

2007-04-03 Thread bahoo
On Apr 3, 2:31 pm, "Matimus" <[EMAIL PROTECTED]> wrote: > It depends on your application, but a 'set' might really be what you > want, as opposed to a list. > > >>> s = set(["0024","haha","0024"]) > >>> s > > set(["0024","haha"])>>> s.remove("0024") > >>> s > > set(["haha"]) This sounds cool. But

how to remove multiple occurrences of a string within a list?

2007-04-03 Thread bahoo
Hi, I have a list like ['0024', 'haha', '0024'] and as output I want ['haha'] If I myList.remove('0024') then only the first instance of '0024' is removed. It seems like regular expressions is the rescue, but I couldn't find t

How to have a list of lists (or array of lists)

2007-04-03 Thread bahoo
Hi, I want to have many lists, such as list0, list1, list2, ..., each one holding different number of items. Is there something like list[0] list[1] list[2] so that I can iterate through this list of lists? Thanks! bahoo -- http://mail.python.org/mailman/listinfo/python-list

transfer data from one machine to another

2007-03-04 Thread bahoo
rce: /home/john/folderA destination: /home/smith/folderB I'm a newbie on linux and ssh networking and python, so your suggestions are welcome! A small working example would be appreciated! bahoo -- http://mail.python.org/mailman/listinfo/python-list