Plugin for dlr/kml import not working
This could be a headache issue, since it is only occuring on some systems, which (so far I know) all run Windows. MSS has been installed with the new pixie installer to version 10.0.
Using the quite common dlrkml.py plugin to read dlr kml files fails for me with the rather unspecific error message
(msui_mainwindow.create_new_flight_track:776): ERROR: file io plugin error: <class 'AttributeError'> 'NoneType' object has no attribute 'tag'
I was able to track down the error to the line
mykml.from_string(kmlf.read().encode('utf-8'))
I am able to mitigate this problem by deleting all <Styles> entries in the kml file. However, for other installations, these entries are ignored (as they should be), and it is possible to open the kml file. I could think that this is a OS specific behaviour of the fastkml package?
what is the default encoding on the windows systems?
there is as I know in the language settings a checkbox to enable UTF-8.
Could it be that windows still uses a different encoding than the other platforms?
fastkml-feedstock on https://github.com/conda-forge/fastkml-feedstock/pull/9 is outdated compared to pypi
On my development environment the tests with the pypi version succeeds. https://mss.readthedocs.io/en/stable/development.html#software-environment-for-development
Could you verify a newer version solves the windows problems?
in a development setup you would need to shift the fastkml to the pypi section and remove it from the dependencies common section until the PR is solved.
[pypi-dependencies]
open-mss = { path = ".", editable = true }
fastkml = "*"
afterwards you can play with trying to install a newer one by
pixi add fastkml==1.1 --pypi
Will check in the next days if my request for maintainance is done
https://github.com/conda-forge/fastkml-feedstock/pull/11
@soerenjoh Did you use the dlrkml.py that I uploaded on the Hessenbox?
This works at leas for me
Thank you for your fast answers, @ReimarBauer!
My Windows encoding is "iso-8859-1/Windows1252". There is an option to change it to UTF-8, which is, however, considered to be a "beta", so I don't want to change it in the beginning of the campaign ;-)
I tried to clone the github repository, changed the pixi.toml file as suggested, and installed the development environment as described on the documentation, but this command failed
(MSS:dev) PS D:\git\Open-MSS\MSS> pixi add fastkml==1.1 --pypi Error: x Unable to solve pypi dependencies for the tutorials environment because no compatible python interpreter can be | installed for the current platform help: Try converting your [pypi-dependencies] to conda [dependencies]
Running msui without installing fastkml in this specific version produced the same error.
I did not describe my workaround correctly in my first post: I needed to remove all the <Style> entries in the DLR KML file, and then I as able to load it. So I don't need a quick fix, but I wanted to document my problem for future developments ;)
@jgrooss Yes, I used exactly the one from the Hessenbox. It seems like it is a problem for Windows installations...
ok, I can reproduce this now.
@soerenjoh utf-8 is standard on linux and mac osx,
yesterday I recognized https://github.com/Open-MSS/MSS/issues/2668 which is another UTF-8 dependency.
Python 3 in general is utf-8 based. I have to read what that now with windows means.
Thank you for your fast answers, @ReimarBauer!
My Windows encoding is "iso-8859-1/Windows1252". There is an option to change it to UTF-8, which is, however, considered to be a "beta", so I don't want to change it in the beginning of the campaign ;-)
I tried to clone the github repository, changed the pixi.toml file as suggested, and installed the development environment as described on the documentation, but this command failed
(MSS:dev) PS D:\git\Open-MSS\MSS> pixi add fastkml==1.1 --pypi Error: x Unable to solve pypi dependencies for the tutorials environment because no compatible python interpreter can be | installed for the current platform help: Try converting your [pypi-dependencies] to conda [dependencies]Running msui without installing fastkml in this specific version produced the same error.
I did not describe my workaround correctly in my first post: I needed to remove all the
<Style>entries in the DLR KML file, and then I as able to load it. So I don't need a quick fix, but I wanted to document my problem for future developments ;)@jgrooss Yes, I used exactly the one from the Hessenbox. It seems like it is a problem for Windows installations...
remove the tutorials section for the test from the pixi.toml
Thanks for that idea. I removed all parts containing "tutorial" from the pixi.toml section and then I needed to move the pygeoif entry to pypi-dependencies (and change the version number to * ). Then I was able to first install pygeoif version 1.5 and then fastkml version 1.1 However, the import problem still was present as before.
I did not describe my workaround correctly in my first post: I needed to remove all the
<Style>entries in the DLR KML file, and then I as able to load it. So I don't need a quick fix, but I wanted to document my problem for future developments ;)
@soerenjoh please send me or Jens-Uwe an origin file and the version with your changes if possible.
@soerenjoh
It is not satisfactory that it works on Linux and macOS but stands out on Windows. Anyway, a file edited with xmllint also works on Windows.
xmllint EDMO.txt > EDMO_new.kml
xmllint is available on linux and macosx
I did send you the files.
the xmllint output works for me, however it is not very convenient to transfer it to a linux system first ;-) But it works as a quick fix.
Hi @soerenjoh I expect the problem in the file because of the linting result. I try to track it down with the examples.
@soerenjoh I just verified without UTF-8 it fails, with UTF-8 enabled on windows it succeeds.
The section you removed I have not found a difference to what xmllint does for this. May be try if it works for you if you just save by an editor the file. I expect the editor cleanup a hidden char which makes the problems already, also without a change of the file.
the xmllint output works for me, however it is not very convenient to transfer it to a linux system first ;-) But it works as a quick fix.
just recognized that I have xmllint on my windows system in the MSS env too.
@soerenjoh does the fix joern introduced also helps to fix this?