CTHRU/Hitrava

[SUPPORT]Unable to generate the files

bikerbaba opened this issue · 8 comments

So i downloaded the source code and the repository.
I followed all the steps and then finally I ran the following command in the terminal
python Hitrava.py --zip HiZip.zip --json_export

I DID rename my huawei health downloaded zip to HiZip.zip.

I get the following error:
File "Hitrava.py", line 81
def init(self, activity_id: str, activity_type: str = TYPE_UNKNOWN):
^
SyntaxError: invalid syntax

I am on a MacBook air running Mac OS 10.15.6

CTHRU commented

Chances are the default python on your system will refer to python version 2.x
This script requires at least python 3.5.1

You can verify this by typing the following command at the terminal prompt.

python --version

You could try altering your command to point to the Python 3 version you installed as follows:

python3 Hitrava.py --zip HiZip.zip --json_export

If it still wouldn't work, I suggest to check your python environment variables. Look at the instructions in the video below.

Python Tutorial: How to Set the Path and Switch Between Different Versions/Executables (Mac & Linux)

Thank you for closing your issue if it works out. If not, let me know here and we'll look into it.

I am on python 3.8. There was an issue with path, which was causing pip to install xmlschema for 2.7 instead of 3.8
I managed to make this work, but now I have a new issue.
I have an output folder that only has a JSON file, not the TCX file. What gives?
The command python Hitrava.py --zip HiZip.zip --json_export runs without errors. I just get a folder called output, which only has JSON files.

CTHRU commented

Don't know yet. I just installed Python 3.8.5 on my system to test and it runs and converts OK (I'm on Windows 10 though).

Would you mind posting the last page or so of the logging of the conversion in the terminal?

bikerbaba@Apoorvas-MacBook-Air Hitrava-3.5.2 % python3 Hitrava.py --zip HiZip.zip --json_export --log_level DEBUG

2020-08-11 16:54:26,725 - DEBUG - main - Hitrava version 3.5.2 (build 2008.0701) started with arguments ['--zip', 'HiZip.zip', '--json_export', '--log_level', 'DEBUG']
2020-08-11 16:54:26,728 - DEBUG - _close_json - JSON file <./output/Motion path detail data & description/motion path detail data.json> closed

I want to add that my watch only has 2 activities in it, a walk and cycling (plus some steps), so that is possibly the reason why the log is short. BTW, the JSON file that is generated is only 2 bytes insize.

CTHRU commented

It looks as if the data in your ZIP file is empty. You can verify this by opening the file below in your ZIP file.

/output/Motion path detail data & description/motion path detail data.json

The most common cause for this is that you forgot to tick the 'Health' option when requesting the data (see also the one but last bullet in the README file section on how to request your data). If nothing is selected, Huawei just generates an empty file.

I will try this again tomorrow after my ride. the file is indeed empty and although I am very sure that I clicked all the right options, i will re-do it tomorrow.
thank you so much for your help.

CTHRU commented

@bikerbaba Hi, I didn't hear back from you in the last 5 days. I assume and I hope you were able to convert your activities. I will close this issue. If you still experience problems, don't hesitate to reopen this issue,

Hey, this worked for me, in power shell.
python3 Hitrava.py --zip HiZip.zip --json_export
thanks for this tool, its great.