flopp / GpxTrackPoster

Create a visually appealing poster from your GPX tracks
MIT License
411 stars 50 forks source link

Code update/pylint mypy #95

Closed lowtower closed 2 years ago

lowtower commented 2 years ago

This tries to solve some issues that arouse by updating the linting and mypy libraries. Two mypy errors are still unsolved, but ignored:

flopp commented 2 years ago

Can I already merge this, or do you want to solve the two mypy errors first?

lowtower commented 2 years ago

To be honest, I don't have a clue at the moment how to solve them. Maybe someone else can jump in and help.

flopp commented 2 years ago

Ok, I see. I guess I will merge the changes for now, as they improve the code base a lot. We will deal with the remaining cases later...

narfel commented 2 years ago

What's the harm of specifying the encoding? It breaks windows compatibility.

lowtower commented 2 years ago

Did a quick search in the Internet and found nothing backing your statement. Could You please elaborate?

narfel commented 2 years ago

I can imagine, took me a while to find that. It happens when you use the gpxpy testfiles (that are intentionally doctored) and it says: UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 530: character maps to To be honest once I figured out that specifying the encoding fixes it I didn't dig deeper as for my purposes I did not see any harm in having it there.

edit: If I remember correctly it was because of a BOM character that trips up windows when it sees or misses it. It can easily convert it when it has the specified encoding or you can do it yourself in code. But I chose the former.

lowtower commented 2 years ago

I am not convinced that this approach is straight forward. I don't know what the test files of gpxpy test against. It might be that an error should be raised with a special test file to see if the package catches it ...

narfel commented 2 years ago

It might be that an error should be raised with a special test file to see if the package catches it ... It was and it is. Meaning there are files especially prepared with and without that header. They were created because people ran into that very problem. In some earlier commit there was a handler for the bom files and it has since been taken out, probably for similar reasons you have. All I can say in my still very limited knowledge is that it fixed my problem and I can test it against a set of test files from that lib. To be honest I chalked it up as a typical windows edge case and be done with it. That's why my initial question was what's the harm in having it?