(text) summary screen during large data conversion

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: May 2008
Posts: 8
Reputation: nclouse is an unknown quantity at this point 
Solved Threads: 0
nclouse nclouse is offline Offline
Newbie Poster

(text) summary screen during large data conversion

 
0
  #1
Jul 1st, 2009
Hello,

I have a certain way i want to do something but im not sure where to start, or if python can even do it.

what i want is a way to display the current action during a large data conversion program.... I want it to look like an GUI installer but have it be text based. let me demonstate......
(imaginary screen)
__________________________________
| step 1: working
| step 2: not started
| step 3: not started
| step 4: not started
| step 5: not started
|
| currently: doing sub step a of step 1
|
|
|
| queries run: 12345
-----------------------------------

then lets say 45 minutes later....

__________________________________
| step 1: done; no errors, no warnings
| step 2: done; no errors, no warnings
| step 3: done; no errors, no warnings
| step 4: working
| step 5: not started
|
| currently: doing sub step d of step 4
|
|
|
| queries run: 987654
-----------------------------------

but i want that without the screen scrolling.

in progress, thats an easy thing to do, but what about python? if not, i can just have it output to a html file every 5 seconds or so or something and just refresh my browser when i want an update.

sys.stdout.write a good place to start?
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 489
Reputation: shadwickman will become famous soon enough shadwickman will become famous soon enough 
Solved Threads: 76
shadwickman's Avatar
shadwickman shadwickman is offline Offline
Posting Pro in Training

Re: (text) summary screen during large data conversion

 
0
  #2
Jul 1st, 2009
What operating system are you using? If MS Windows, you can use os.system('cls') to clear the console window before reprinting the progress display. Yes, yes, I know that clearing the screen isn't good because a) this won't work on Mac or GNU/Linux, b) it may cause users to lose any important data they had in the console before running your script, and c) it introduces security issues into your program *. This is what you're looking for though, right? So I guess we can make an exception for clearing the screen in this case...

* as "cls" is a program on Windows that does this, if someone were to put a program named "cls" into the same folder that this script was run out of, then Windows would execute that program rather than the native "cls". Hence, very large security issues. (Thanks to Siddhant Sanyam for bringing that to light.)

P.S. sys.stdout.write is only an output stream, much like the print expression. Although, sys.stdout.write will not put a newline after each call like print, and if you call print "somethinghere", with that comma after, it won't put a newline but it will put one space.
Last edited by shadwickman; Jul 1st, 2009 at 11:19 pm.
"Two good old boys in a fire-apple red convertible. Stoned. Ripped. Twisted. Good people."
- Hunter S. Thompson

my photography
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 8
Reputation: nclouse is an unknown quantity at this point 
Solved Threads: 0
nclouse nclouse is offline Offline
Newbie Poster

Re: (text) summary screen during large data conversion

 
0
  #3
Jul 3rd, 2009
actually, i think a logging system that creates some kind of nice html output so users can see what is going on and why nothing works would be nice. i think i will go that route. thanks for the advice.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 489
Reputation: shadwickman will become famous soon enough shadwickman will become famous soon enough 
Solved Threads: 76
shadwickman's Avatar
shadwickman shadwickman is offline Offline
Posting Pro in Training

Re: (text) summary screen during large data conversion

 
0
  #4
Jul 3rd, 2009
That is a better option. And this way you can achieve a nicer output without having to resort to GUI programming. Good luck!
"Two good old boys in a fire-apple red convertible. Stoned. Ripped. Twisted. Good people."
- Hunter S. Thompson

my photography
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



Tag cloud for Python
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC