Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpxinfo AttributeError: GPX instance has no attribute 'author' #48

Closed
szo1215 opened this issue Oct 20, 2015 · 9 comments
Closed

gpxinfo AttributeError: GPX instance has no attribute 'author' #48

szo1215 opened this issue Oct 20, 2015 · 9 comments

Comments

@szo1215
Copy link

szo1215 commented Oct 20, 2015

Hi. I'm using gpxpy very well. but When I analyzed my strava gpxfile, It didn't work because there was no author information in this file. In this case What should i do?

@tkrajina
Copy link
Owner

Hi, Can you send me an example track to test this?

@szo1215
Copy link
Author

szo1215 commented Oct 27, 2015

It is strava gpx file.
Thanks.

2015-10-27 2:52 GMT+09:00 Tomo Krajina notifications@github.com:

Can you send me an example track to test this?


Reply to this email directly or view it on GitHub
#48 (comment).

@tkrajina
Copy link
Owner

I tried to parse and convert back to XML, and to me it looks like it works:

In [1]: import gpxpy

In [4]: gpx = gpxpy.parse(file('test_files/gpx1.1_with_all_fields.gpx'))

In [5]: gpx.author_name
Out[5]: 'author name'

In [6]: gpx = gpxpy.parse(file('test_files/gpx1.0_with_all_fields.gpx'))

In [7]: gpx.author_name
Out[7]: 'example author'

It is strava gpx file.

I know it's a Strava file, you already said that. I asked if you can send me that file. I don't plan to experiment with Strava and figure out what "It didn't work" means. If you already have a file -- why wouldn't you help me by sending it? Also, a couple of lines with your gpxpy code is welcome.

I know this may sound rude, but keep in mind that I am willing to help/fix your bug. "It's a strava file" and "It didn't work" just isn't a valid bug request.

@szo1215
Copy link
Author

szo1215 commented Oct 28, 2015

I don't have experience about sending open source issue. so I did that.
If I were send other bug request, I would get more cautious.
I'm sorry.

@jwm-art-net
Copy link

Have same issue with GPX files which have been converted from TCX files by gpsbabel. The TCX files were converted from Garmin FIT files by fittotcx.
http://pastebin.com/NhXC6xVX (expires one month from 20151105)

@tkrajina
Copy link
Owner

tkrajina commented Nov 6, 2015

Note that the gpx1.1 implementation has no simple <author> property. That's why the new gpxpy (1.0+) has a slightly different object model. The properties in the gpxpy are made to work with both gpx1.0 and gpx1.1. That's why the author fields are:

        self.author_name = None
        self.author_email = None
        self.author_link = None
        self.author_link_text = None
        self.author_link_type = None

If you try to add <author>qwe</author> in your file and check gpx.author_name (not gpx.author) it should be qwe.

@jwm-art-net
Copy link

I'm not using the Library API but the gpxinfo command line tool. I don't really follow what you're saying. I added <author>qwe</author> to the file and re-ran gpxinfo and still get the above error message. Then I converted a TCX into a GPX 1.1 thinking that would help but still the same 'no author' error.

It seems to me that the author attribute is optional and the case where it is missing should be handled gracefully. Is that not correct?

@tkrajina
Copy link
Owner

tkrajina commented Nov 8, 2015

I changed a couple of lines now. I think it should work now, can you try?

@tkrajina tkrajina closed this as completed Nov 8, 2015
@jwm-art-net
Copy link

Yes that works for me. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants