How do *you* use Python in non-GUI work?

Ken Starks straton at lampsacos.demon.co.uk
Mon May 19 09:31:51 EDT 2008


John Salerno wrote:
> Hey all. Just thought I'd ask a general question for my own interest. Every time I think of something I might do in Python, it usually involves creating a GUI interface, so I was wondering what kind of work you all do with Python that does *not* involve any GUI work. This could be any little scripts you write for your own benefit, or what you do at work, if you feel like talking about that! :)
> 
> Thanks.
The vast majority of my Python work is Non-GUI.

As an example, this weekend, I wrote a script to help
in making a 'Lyrics' track in an audacity file, which
is (more-or-less) an XML variety.

In audacity, I created 'markers' in the file (as
the song played) at the start of each line. The result
was 'blank' markers at the correct times:

<labeltrack name="Lyrics" numlabels="25">

     <label t="18.50121034" t1="18.50121034" title=""/>

     <label t="24.34844390" t1="24.34844390" title=""/>

<!-- Etc -->
		
</labeltrackl>


My Python script took a text file, and inserted the words, as well
as a title for the whole song.


<labeltrack name="Lyrics" numlabels="26">
     <label t="0.25" t1="0.25" title="Katie Melua. 'Nine million 
bicycles in Beijing' "/>
     <label t="18.50121034" t1="18.50121034" title="There are nine 
million bicycles in Beijing,"/>
     <label t="24.34844390" t1="24.34844390" title="That's a fact,"/>
     <label t="27.12436227" t1="27.12436227" title="It's a thing we 
can't deny,"/>


<!-- Etc -->
		
</labeltrackl>


(The script used FourSuite)

You can do this in FourSuite itself, but it can be error-prone if
you miss out one.

I can this in 'Scite' a text editor which puts your input in one window, 
and the output in another. Scite is a text editor that comes free with
Ruby, by the way.



More information about the Python-list mailing list