On Fri, August 8, 2008 12:04, Dave G wrote:
> Andrew
>
>
> you are dead right about python being the way to go I agree entirely
>
> the only reason for doing it this way is a lack of python knowledge but  I
> hope to correct this in the future
>
> currently I have a range of simple bash stuff for various GPS tasks this
> script was just cut out of one of them & was a quick and dirty way of
> solving my current issue

Well Dave, the future starts now!  Right now!  Now again!  Yes, always now!

I think I can honestly say that this project would be an ideal candidate
for a learning Python exercise- it's well defined and self-contained. 
Fortunately you have a working solution, so you are not under pressure to
make a Python version and make it work quickly.

Since Python is a scripting language you may find that the code you write
will look very similar to what you have already written in bash, but
instead of calling system utilities (such as sed) you will call Python
functions or your own subroutines.

Here's a good writeup to get you started:

<http://www.robertprice.co.uk/robblog/archive/2007/1/Using_A_Bluetooth_GPS_From_Python.shtml>

Instead of printing "Lat:" and "Long:" you can "print" the GPX file
(there's no need to use any XML tools for this, just a bunch of print
statements will work).

And if you are interested in learning Python I recommend the book "Dive
Into Python" by Mark Pilgrim.  There is a copy in Christchurch library, or
you can download the book from the website (it's even legal to print your
own copy!).

http://www.diveintopython.org/

Best wishes,

Andrew

PS The future is now!

Reply via email to