[Tutor] Parse MPL files

Corey Richardson kb1pkl at aim.com
Sat Jan 8 00:33:42 CET 2011


On 01/07/2011 06:29 PM, PyProg PyProg wrote:
> 2011/1/7 Corey Richardson <kb1pkl at aim.com>:
> 
> Hi,
> 
> Thanks for your response.
> 
>> A google search yields no results for one. If you know the structure of
>> the MPL file, you can write your own parser. Look through the file with
>> a hex editor like Bless first, if you need to. Most likely the
>> information you want is right at the start of the file.
> 
> Parts of the data is inaccessible (very large parts in fact).The
> structure is like that:
> 
> Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55)
> [GCC 4.4.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> o = open("/home/toto/ae/00001.MPL", "r")
>>>> oo = o.readlines()
>>>> for listage, ligne in enumerate(oo):
> ...     print "Ligne n°", listage, ":", ligne
> ...
> Ligne n° 0 : MPLS0100:�
> 
> Ligne n° 1 : �@�`00005M2TS�X1�P>                �1und
> �und`00002M2TSp��>              �1und   �und`00003M2TSqu��>
>  �1und     �und`00004M2T��>                �1und
> �und:�X��p��qu����J▒▒6PLEXDR▒�� �
> 
> Ligne n° 2 : 2011. 1. 1
> 
> GH���� DD� :  �T%d
> 
> Ligne n° 4 : 2011. 1. 1T%dGH���� X&�
> 
> Ligne n° 5 : 2011. 1. 1T%dGH����▒�
> 
> Ligne n° 6 : 2011. 1. 1T%dGH����
>                                 �▒▒
> 
> ����(����~�������������B�������~���"�����'��
> �u���A���>���O��$mCy�C�N����g�����>�3������@F�^�,dW&#�Y�}n�����A�$▒�`��N0
>     �d1A2
> 
> Ligne n° 7 :
> 
> Ligne n° 8 : WGS-84    1GPSFRANCE
> 
> ,dW&e n° 9 : FINISTÈRELOCMARIA-PLOUZANÉ---��N0
>     �d1A2
> 
> Ligne n° 10 :
> 
> Ligne n° 11 : WGS-84    1GPSFRANCE
> 
> 5"A2e n° 12 : FINISTÈRELOCMARIA-PLOUZANÉ---��N0qdW*�d
> 
> Ligne n° 13 :
> 
> Ligne n° 14 : WGS-84    GPSFRANCE
> 
> Ligne n° 15 : FINISTÈRE
> 5"A2                   PLOUGONVELINCENTRE AQUATIQUE TRÉZIROISE��N0qdW*�d
> 
> Ligne n° 16 :
> 
> Ligne n° 17 : WGS-84    GPSFRANCE
> 
> Ligne n° 18 : FINISTÈRE
>                        PLOUGONVELINCENTRE AQUATIQUE TRÉZIROISE� �
> 
> ��DMC-TZ10�DMC-TZ10�DMC-TZ10�DMC-TZ10
> 
> 
> How to set up a hex editor ?
> 
>> ~Corey Richardson
> 
> a+
> 

Open the file not with 'r' but with 'rb'. That opens the file as binary,
not text. To use Bless, run sudo apt-get install bless on Ubuntu and
variants, for Windows try HxD, http://mh-nexus.de/en/hxd/.


More information about the Tutor mailing list