dopefishh / pympi

A python module for processing ELAN and Praat annotation files
MIT License
93 stars 39 forks source link

XML Namespace problem when opening and saving a file #15

Closed thomaskisler closed 5 years ago

thomaskisler commented 5 years ago

When opening and saving an EAF file with pympi, the resulting XML file fails to validate due to namespace information being added twice to the output file.

An MWE is:

import pympi filename = "minimalExample.eaf" eafObj = pympi.Elan.Eaf(filename) eafObj.to_file(filename)

A very easy and short eaf file with which the error can be reproduced is attached (needed to replace the extension from eaf to txt to to upload it): minimalExample.txt

dopefishh commented 5 years ago

Thanks for reporting. I'll try to find time this week

On 24 April 2019 09:07:55 CEST, thomaskisler notifications@github.com wrote:

When opening and saving an EAF file with pympi, the resulting XML file fails to validate due to namespace information being added twice to the output file.

An MWE is:

import pympi filename = "minimalExample.eaf" eafObj = pympi.Elan.Eaf(filename) eafObj.to_file(filename)

A very easy and short eaf file with which the error can be reproduced is attached (needed to replace the extension from eaf to txt to to upload it): minimalExample.txt

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/dopefishh/pympi/issues/15

dopefishh commented 5 years ago

Dear thomaskisler. I cannot reproduce this.

I did the following (and the same with python3):

$ git clone github.com:dopefishh/pympi
$ cd pympi
$ virtualenv -p python2 env
$ . env/bin/activate
$ python setup.py install
$ wget -O minimal.eaf https://github.com/dopefishh/pympi/files/3110970/minimalExample.txt
$ python 
Python 2.7.16 (default, Apr  6 2019, 01:42:57)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pympi
>>> eafObj = pympi.Elan.Eaf("minimal.eaf")
Parsing unknown version of ELAN spec... This could result in errors...
>>> eafObj.to_file("minimal2.eaf")
$ diff minimal.eaf minimal2.eaf

There is no difference in files and they both open fine in ELAN

thomaskisler commented 5 years ago

You are right, I can neither. If I ever find a way, I reopen this issue.