Appending a log file and see progress as program executes

2007-05-30 Thread Karim Ali
Hi, I am writing a program that will take several days to execute :) and would like to append to a log file but be able to open that file at any time and see the errors that have occured. So this is what I am doing: -- flog = open('out.log', 'a')

Reading a file and resuming reading.

2007-05-25 Thread Karim Ali
Hi, Simple question. Is it possible in python to write code of the type: - while not eof - really want the EOF and not just an empty line! readline by line end while; - What I am using now is the implicit for loop after a readlines().

Re: Reading a file and resuming reading.

2007-05-25 Thread Karim Ali
Hrvoje Niksic [EMAIL PROTECTED] wrote: If you open the file in binary mode, you can easily keep track of the position in file: bytepos = 0 with file(filename) as f: for line in f: ... process line ... bytepos += len(line) If you need to restart the operation, simply seek to the

Re: Call script which accepts com. line par. from another scriptand error control

2007-05-24 Thread Karim Ali
another scriptand error control Date: Wed, 23 May 2007 17:21:47 -0700 Karim Ali wrote: def MAIN(expression2parse)- add a main so can call from other script Of course you don't mean you want another python interpreter to fire up and run the other script? Here

Re: Call script which accepts com. line par. from another scriptanderror control

2007-05-24 Thread Karim Ali
Karim Ali wrote: What I still dont know though is how do I handle the fact that the first script is expecting command line parameters. I would like to be able to replace the command line parameters by a variable such that the second script can call: first_script.main(command line

Call script which accepts com. line par. from another script and error control

2007-05-23 Thread Karim Ali
Hi, I would really appreciate help on this. I have a script (s1.py) which I would like to call from another script (s2.py). No problem there. The first issue is that s1.py has a command line parser which I would like to keep but instead of fetching the information from the command line, I