fabricebrito / ambit2gpx

Automatically exported from code.google.com/p/ambit2gpx
0 stars 0 forks source link

Conversion from sml to gpx do not work on Mac OS #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, 

I've tried the ambit2gpx tool for the first time today, but I did not manage to 
convert correctly my sml file.
The conversion seems to be ok, as I do not see any error messages, and I get an 
output gpx file generated. But this output file contains only the GPX 
headers... See files attached in order to reproduce the problem

My MAC OS X version is 10.7.5 (it is a Macbook Pro, 13")
Python version is 2.7.1 (it was already installed)
What is the expected output? What do you see instead?

I tried with ambit2gpx clone version, as my moveslink app has been updated 
recently (version 1.2.8)

Original issue reported on code.google.com by sportmg...@gmail.com on 25 Aug 2014 at 2:51

Attachments:

GoogleCodeExporter commented 8 years ago
Sorry I didn't test it on Mac (I'm not the creator of the ambit2gpx script by 
the way, just a guy who uses it and happens to be in software!). I suspect 
there's something different about the file extension handling on Mac and it's 
trying to process it like the old XML format. The output should be like this:

> $ python ambit2gpx.py 46B2095118000200-2014-08-25T08_53_11-0.sml 
> Parsing file 46B2095118000200-2014-08-25T08_53_11-0.sml
> Done.
> Creating file 46B2095118000200-2014-08-25T08_53_11-0.gpx
> ...................
> Done.

and create the attached file.

If you add the following at line 244 

print "extension is {0}".format(ext)

and run the script again, it should also output:

> extension is .sml

Original comment by mr.greg...@gmail.com on 26 Aug 2014 at 11:59

Attachments:

GoogleCodeExporter commented 8 years ago
I've got a working version for Mac against Moveslink 1.2.9.

I worked against the "6e58fb0e0e61  Adds simple support for Moveslink 1.2.8 but 
removes support for earlier versions." in mr.gregson's clone.  Same principle.  
I will have broken support for earlier versions and probably non-Mac but the 
change points in the right direction.

diff ...ambit2gpx-1.2.8.py ambit2gpx-1.2.9osx.py 
182,183c182    # I get to the DeviceLog tag directly below, so I don't do this 
relative navigation - PC 20140909
<         deviceLog = childElements(root)[0]
<         for node in childElements(deviceLog):
---
>         for node in childElements(root):
242c241  # self explanatory   
<         filename += ".xml"
---
>         filename += ".sml"
246a246     # It works with this kept in from the prior version - not tested 
without it so may not be necessary - PC 20140909
>     file.readline() # Skip first line
253c254   # without mucking about I just get the "DeviceLog" tag and go from 
there.  this ends up in self.__root - PC 20140909
<     top = doc.getElementsByTagName('sml')
---
>     top = doc.getElementsByTagName('DeviceLog')

Original comment by peterjnc...@gmail.com on 9 Sep 2014 at 7:00

GoogleCodeExporter commented 8 years ago
I'm handling currently duplicate issues #7 & #8.

Original comment by jconr...@gmail.com on 21 Dec 2014 at 10:28