python-ant-downloader icon indicating copy to clipboard operation
python-ant-downloader copied to clipboard

problem with ubuntu 13.10

Open merira opened this issue 11 years ago • 16 comments

Hey there, I've been using your downloader for almost a year now and never had a problem. However, since I updated to ubuntu 13.10, it will no longer transmit tcx files to garmin connect. The trouble is that there is no error message. any idea where I could start looking for a problem?

merira avatar Feb 11 '14 12:02 merira

It is pulling data from the watch, but not uploading? Check that tcx files exist in ~/.antd/[device serial number]/tcx.

Make sure its enabled uploading in configuration;

~/.antd/antd.cfg should have; [antd.connect] enabled=True username=... password=...

Then, make sure your device has a little data read for download, and run;

ant-downloader --verbose > log.txt 2>&1

You can send me the log, [braiden] at [braiden.org]. I'll take a look.

On Tue, Feb 11, 2014 at 7:53 AM, merira [email protected] wrote:

Hey there, I've been using your downloader for almost a year now and never had a problem. However, since I updated to ubuntu 13.10, it will no longer transmit tcx files to garmin connect. The trouble is that there is no error message. any idea where I could start looking for a problem?

Reply to this email directly or view it on GitHubhttps://github.com/braiden/python-ant-downloader/issues/51 .

braiden avatar Feb 11 '14 17:02 braiden

I have the same problem. I don't think it's related to Ubuntu - I use 3 different computers (all running Ubuntu 12.04) to upload my data, and I have that problem with at least 2 of them for a few days now. The tcx file is correctly downloaded from the watch. I don't see any error message. I can upload the tcx file to garmin manually. I guess that something has changed at the garmin site.

I will use the --verbose option next time (hopefully tomorrow) and send the log.

oliverkurth avatar Feb 12 '14 06:02 oliverkurth

Your site seems to be down.

Everything's fine, in fact. TCX are there, it says it' uploading.

Now I got this message once:

[MainThread] 2014-02-11 23:14:46,972 WARNING Failed to uplaod to Garmin Connect. Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/antd/connect.py", line 79, in data_available self.upload(format, file) File "/usr/local/lib/python2.7/dist-packages/antd/connect.py", line 126, in upload self.opener.open(request) File "/usr/lib/python2.7/urllib2.py", line 404, in open response = self._open(req, data) File "/usr/lib/python2.7/urllib2.py", line 422, in _open '_open', req) File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain result = func(*args) File "/usr/local/lib/python2.7/dist-packages/poster/streaminghttp.py", line 142, in http_open return self.do_open(StreamingHTTPConnection, req) File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open raise URLError(err) URLError: <urlopen error [Errno 32] Broken pipe>

merira avatar Feb 12 '14 09:02 merira

FYI, My project (Garmin Connect Python Uploader) has recently received some complaints about upload problems as well. I haven't had a chance to look into it yet, but I'm wondering if Garmin has changed their API.

https://sourceforge.net/p/gcpuploader/discussion/general/thread/a7375183/?limit=25#8da2/438f

dlotton avatar Feb 12 '14 16:02 dlotton

Okay, I just downloaded from the watch, using the --verbose option. This is at the end (I don't think the previous output is interesting, but let me know if you need it):

[MainThread] 2014-02-12 17:43:07,456 INFO tcx: writing 20140212-174242.raw -> /home/okurth/.antd/0xe5b775e8/tcx/20140213-003000.tcx. [MainThread] 2014-02-12 17:43:07,535 DEBUG Fetching cookies from Garmin Connect. [MainThread] 2014-02-12 17:43:08,049 DEBUG Posting login credentials to Garmin Connect. username=okurth [MainThread] 2014-02-12 17:43:10,863 DEBUG Checking if login was successful. [MainThread] 2014-02-12 17:43:11,058 INFO Uploading /home/okurth/.antd/0xe5b775e8/tcx/20140213-003000.tcx to Garmin Connect. [MainThread] 2014-02-12 17:43:12,159 DEBUG SEND: a4094f004403000000000000a5 [MainThread] 2014-02-12 17:43:12,160 DEBUG Executing Command. RESET_SYSTEM() [MainThread] 2014-02-12 17:43:12,160 DEBUG SEND: a4014a00ef [Thread-1] 2014-02-12 17:43:12,162 DEBUG RECV: a4016f20ea [Thread-1] 2014-02-12 17:43:12,162 DEBUG Processing reply. STARTUP_MESSAGE(startup_message=32)

oliverkurth avatar Feb 13 '14 01:02 oliverkurth

Thanks, I see the same issue too. As suggested, Garmin may have changed something. I'll investigate.

On Wed, Feb 12, 2014 at 8:46 PM, oliverkurth [email protected]:

Okay, I just downloaded from the watch, using the --verbose option. This is at the end (I don't think the previous output is interesting, but let me know if you need it):

[MainThread] 2014-02-12 17:43:07,456 INFO tcx: writing 20140212-174242.raw -> /home/okurth/.antd/0xe5b775e8/tcx/20140213-003000.tcx. [MainThread] 2014-02-12 17:43:07,535 DEBUG Fetching cookies from Garmin Connect. [MainThread] 2014-02-12 17:43:08,049 DEBUG Posting login credentials to Garmin Connect. username=okurth [MainThread] 2014-02-12 17:43:10,863 DEBUG Checking if login was successful. [MainThread] 2014-02-12 17:43:11,058 INFO Uploading /home/okurth/.antd/0xe5b775e8/tcx/20140213-003000.tcx to Garmin Connect. [MainThread] 2014-02-12 17:43:12,159 DEBUG SEND: a4094f004403000000000000a5 [MainThread] 2014-02-12 17:43:12,160 DEBUG Executing Command. RESET_SYSTEM() [MainThread] 2014-02-12 17:43:12,160 DEBUG SEND: a4014a00ef [Thread-1] 2014-02-12 17:43:12,162 DEBUG RECV: a4016f20ea [Thread-1] 2014-02-12 17:43:12,162 DEBUG Processing reply. STARTUP_MESSAGE(startup_message=32)

Reply to this email directly or view it on GitHubhttps://github.com/braiden/python-ant-downloader/issues/51#issuecomment-34940236 .

braiden avatar Feb 13 '14 16:02 braiden

I think I've found the cause of the issue and fixed. Grab latest version of code and let me know if you have issues (I also added better logging of response received from garmin.).

@dlotton In case your uploader is affected by the same bug here was issue:

--602cc69be5714babbb2b665dbdc1f9e4
Content-Disposition: form-data; name="data"; filename="20140211-165601.tcx"
Content-Type: text/plain; charset=utf-8

The "filename" attribute must not include a path component or garmin connect replies with an error something like "unsupported file type". I was using python "poster" library which adds a filename path by default.

braiden avatar Feb 15 '14 22:02 braiden

Thanks for the heads-up. I was just looking into this, myself. I'll look at the filename.

dlotton avatar Feb 15 '14 23:02 dlotton

Hmmm, well, my filename looks fine...

Content-Disposition: form-data; name="data"; filename="2014-02-15_20-45-03_4_117.fit" Content-Type: application/octet-stream

I've tied a TCX file as well.

I'm kind of stumped with this. I've done a capture of the web form upload and one from my program trying to upload the same file. I'm not seeing the issue in the form data or anything. Some of my parameters are different (such as User-Agent), and some parameters are in different order, but I don't think that should matter.

Do you have a complete capture of your POST transaction you could share?

[edit] btw, I'm also getting a complaint about an unsupported file type.

dlotton avatar Feb 16 '14 02:02 dlotton

https://gist.github.com/braiden/ef841d3728d104a0fb0c is a sample of my successful upload except that I redacted Cookie headers.

braiden avatar Feb 16 '14 04:02 braiden

Braiden,

Thanks for the POST transaction. It was helpful. Between your capture above and a capture of the web form I figured it out.

In the multi-part form post I was putting the 'responseContentType' part before the 'filename' part of my post. This worked fine for over two years and now suddenly changed. It seems like they are now parsing the parts of he multi-part post by their position in the stream instead of looking at the name of the data field. I'm a total hack programmer, but this seems like a supremely bad idea, even to me.

Thanks again.

Dave L.

dlotton avatar Feb 16 '14 21:02 dlotton

hmm, thanks for the efforts, but I have still not been able to upload. here's the end of my output:

[MainThread] 2014-02-17 20:18:56,857 WARNING Username mismatch, probably OK, if upload fails check user/pass. Merira != pseudo [MainThread] 2014-02-17 20:18:56,902 INFO Uploading /home/emiliano/.antd/0xe4d0161d/tcx/20130920-062425.tcx to Garmin Connect. [MainThread] 2014-02-17 20:18:57,384 ERROR Failed to upload to garmin connect. Message follows: [MainThread] 2014-02-17 20:18:57,384 ERROR {u'detailedImportResult': {u'successes': [], u'fileName': u'20130920-062425.tcx', u'processingTime': 118, u'report': None, u'uploadId': u'', u'fileSize': 6354, u'owner': 4548472, u'failures': [{u'messages': [{u'content': u'Duplicate Activity.', u'code': 202}], u'externalId': u'2013-09-20T06:24:25Z', u'internalId': 378343638}], u'creationDate': u'2014-02-17 19:18:57.267 GMT', u'ipAddress': u'192.168.18.45'}} [MainThread] 2014-02-17 20:18:57,384 WARNING Failed to uplaod to Garmin Connect. Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/antd/connect.py", line 79, in data_available self.upload(format, file) File "/usr/local/lib/python2.7/dist-packages/antd/connect.py", line 133, in upload raise GarminUploadFailure() GarminUploadFailure

2014-02-16 22:19 GMT+01:00 dlotton [email protected]:

Braiden,

Thanks for the POST transaction. It was helpful. Between your capture above and a capture of the web form I figured it out.

In the multi-part form post I was putting the 'responseContentType' part before the 'filename' part of my post. This worked fine for over two years and now suddenly changed. It seems like they are now parsing the parts of he multi-part post by their position in the stream instead of looking at the name of the data field. I'm a total hack programmer, but this seems like a supremely bad idea, even to me.

Thanks again.

Dave L.

Reply to this email directly or view it on GitHubhttps://github.com/braiden/python-ant-downloader/issues/51#issuecomment-35212937 .

merira avatar Feb 17 '14 19:02 merira

u'failures': [{u'messages': [{u'content': u'Duplicate Activity.', u'code': 202}]

Merira, The above excerpt from your output suggests that the activity already exists on Garmin Connect (note: Duplicate Activity). In other words, it looks like it has already been uploaded.

dlotton avatar Feb 17 '14 19:02 dlotton

Its failing to upload a file 20130920-062425.tcx because Garmin claims a file with that name was already uploaded. Since this is an old file (2013) maybe it was previously uploaded, or you manually uploaded?

You may need to manually remove this file from queue of pending uploads. Just deleted file below to clear all pending uploads. You can also edit the txt file and remove only failing files.

~/.antd/garmin-connect-upload-queue.txt

Actually, I need to clean this up. Did you 'force all downloads' from the watch to try to sync up with garmin connect? The issue with this use case is I given up uploading after the first failure. I'll update code to keep trying more files even if the first on fails.

On Mon, Feb 17, 2014 at 2:27 PM, dlotton [email protected] wrote:

u'failures': [{u'messages': [{u'content': u'Duplicate Activity.', u'code': 202}]

Merira, The above excerpt from your output suggests that the activity already exists on Garmin Connect (note: Duplicate Activity).

Reply to this email directly or view it on GitHubhttps://github.com/braiden/python-ant-downloader/issues/51#issuecomment-35315073 .

braiden avatar Feb 17 '14 19:02 braiden

Yep, I did use the force-send option. Thanks. Will do that. Le 17 févr. 2014 20:36, "Braiden Kindt" [email protected] a écrit :

Its failing to upload a file 20130920-062425.tcx because Garmin claims a file with that name was already uploaded. Since this is an old file (2013) maybe it was previously uploaded, or you manually uploaded?

You may need to manually remove this file from queue of pending uploads. Just deleted file below to clear all pending uploads. You can also edit the txt file and remove only failing files.

~/.antd/garmin-connect-upload-queue.txt

Actually, I need to clean this up. Did you 'force all downloads' from the watch to try to sync up with garmin connect? The issue with this use case is I given up uploading after the first failure. I'll update code to keep trying more files even if the first on fails.

On Mon, Feb 17, 2014 at 2:27 PM, dlotton [email protected] wrote:

u'failures': [{u'messages': [{u'content': u'Duplicate Activity.', u'code': 202}]

Merira, The above excerpt from your output suggests that the activity already exists on Garmin Connect (note: Duplicate Activity).

Reply to this email directly or view it on GitHub< https://github.com/braiden/python-ant-downloader/issues/51#issuecomment-35315073

.

Reply to this email directly or view it on GitHubhttps://github.com/braiden/python-ant-downloader/issues/51#issuecomment-35315737 .

merira avatar Feb 17 '14 20:02 merira

Just to confirm the tip of repo works for me. I was able to upload TCXs previously collected using an old version of ant-downloader to Garmin Connect using the tip of the tree build.

mehrar avatar Mar 06 '14 23:03 mehrar