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

Error line 17 activity.py #4

Open
AstraJens opened this issue Dec 13, 2024 · 14 comments · May be fixed by #5
Open

Error line 17 activity.py #4

AstraJens opened this issue Dec 13, 2024 · 14 comments · May be fixed by #5

Comments

@AstraJens
Copy link

PS C:\Users\Jens> & C:/Users/Jens/AppData/Local/Microsoft/WindowsApps/python3.11.exe s:/AAA/samsunghealth_astrajens1_20241130133710/activity.py
Traceback (most recent call last):
File "s:\AAA\samsunghealth_astrajens1_20241130133710\activity.py", line 184, in
data = merge_data(fetch_floor_data(), fetch_calorie_data(), fetch_activity_data())
^^^^^^^^^^^^^^^^^^
File "s:\AAA\samsunghealth_astrajens1_20241130133710\activity.py", line 17, in fetch_floor_data
raise Exception("No floors data found.")
Exception: No floors data found.

@AstraJens AstraJens changed the title Error 3 Error line 17 activity.py Dec 13, 2024
@PhilippImhof
Copy link
Owner

Hello. This exception is raised on purpose. It means that the data regarding the number of floors climbed could not be found in your export. Can you check whether you have files matching com.samsung.health.floors_climbed.*.csv ?

@PhilippImhof PhilippImhof linked a pull request Dec 13, 2024 that will close this issue
@PhilippImhof
Copy link
Owner

You might want to try an update version from this branch:

https://github.com/PhilippImhof/FromSamToGarm/tree/issue-3

Please tell me, if that works for you. It will inform that no floor data could be found, but continue anyway.

@AstraJens
Copy link
Author

AstraJens commented Dec 13, 2024

yes i have com.samsung.health.floors_climbed.20241130133710.csv

with Visual Code Studio
PS C:\Users\Jens> & C:/Users/Jens/AppData/Local/Microsoft/WindowsApps/python3.11.exe s:/AAA/samsunghealth_astrajens1_20241130133710/activity.py
s:\AAA\samsunghealth_astrajens1_20241130133710\activity.py:19: UserWarning: No floor data found.
warnings.warn("No floor data found.")
s:\AAA\samsunghealth_astrajens1_20241130133710\activity.py:48: UserWarning: No calorie data found.
warnings.warn("No calorie data found.")
s:\AAA\samsunghealth_astrajens1_20241130133710\activity.py:76: UserWarning: No activity data found.
warnings.warn("No activity data found.")

on my raspberrypi5

pi@raspberrypi5:~/AAA $ python activity.py
Traceback (most recent call last):
File "/home/pi/AAA/activity.py", line 184, in
data = merge_data(fetch_floor_data(), fetch_calorie_data(), fetch_activity_data())
^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/AAA/activity.py", line 87, in fetch_activity_data
int(row["day_time"]) / 1000
^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '2023-12-30 00:00:00.000'

@PhilippImhof
Copy link
Owner

If the script cannot find calories, floors climbed and weight, you are probably running it in the wrong directory.

The error you get on the raspberry pi comes from malformed data in the CSV. This has been addressed in issue #2, I am waiting for feedback from the reporter. You might want to check it out as well.

@AstraJens
Copy link
Author

AstraJens commented Dec 14, 2024

.\files
.\json
*.csv

i use this activity.py on root directory... where the .csv files are saved. i tried it in the different directory's
The weight.py is working...

@PhilippImhof
Copy link
Owner

That is very strange, because I simply use glob to check for the files, so there is not much that could go wrong.

Would you mind posting the list of CSV files you have in that directory? You could probably do something like:

C:\yourpath> dir com.samsung.health.floors_climbed.*.csv
C:\yourpath> dir com.samsung.shealth.calories_burned.details.*.csv
C:\yourpath> dir com.samsung.shealth.activity.day_summary.*.csv

@AstraJens
Copy link
Author

AstraJens commented Dec 14, 2024

Only one file from all of these three types

S:\AAA\samsunghealth>dir com.samsung.health.floors_climbed.*.csv
Datenträger in Laufwerk S: ist Volume HD 6TB
Volumeseriennummer: 84D6-63CE

Verzeichnis von S:\AAA\samsunghealth

14.12.2024 12:18 2.215.474 com.samsung.health.floors_climbed.20241214121856.csv
1 Datei(en), 2.215.474 Bytes
0 Verzeichnis(se), 3.274.738.540.544 Bytes frei

S:\AAA\samsunghealth>dir com.samsung.shealth.calories_burned.details.*.csv
Datenträger in Laufwerk S: ist Volume HD 6TB
Volumeseriennummer: 84D6-63CE

Verzeichnis von S:\AAA\samsunghealth

14.12.2024 12:19 624.876 com.samsung.shealth.calories_burned.details.20241214121856.csv
1 Datei(en), 624.876 Bytes
0 Verzeichnis(se), 3.274.738.540.544 Bytes frei

S:\AAA\samsunghealth>dir com.samsung.shealth.activity.day_summary.*.csv
Datenträger in Laufwerk S: ist Volume HD 6TB
Volumeseriennummer: 84D6-63CE

Verzeichnis von S:\AAA\samsunghealth

14.12.2024 12:19 915.952 com.samsung.shealth.activity.day_summary.20241214121856.csv
1 Datei(en), 915.952 Bytes
0 Verzeichnis(se), 3.274.738.540.544 Bytes frei

S:\AAA\samsunghealth>

If you like, we can talk over Discord....

@PhilippImhof
Copy link
Owner

Thanks for checking that. This is very, very strange. Could you try the following:

S:\AAA\samsunghealth> C:/Users/Jens/AppData/Local/Microsoft/WindowsApps/python3.11.exe
>>> import glob
>>> glob.glob("com.samsung.health.floors_climbed.*.csv") 
>>> exit

S:\AAA\samsunghealth> C:
C:\> cd \Users\Jens
C:\Users\Jens> C:/Users/Jens/AppData/Local/Microsoft/WindowsApps/python3.11.exe
>>> import glob
>>> glob.glob("com.samsung.health.floors_climbed.*.csv") 
>>> exit

Because, in your first comment, I see you started python in the directory C:\Users\Jens, so maybe this is used as the working directory.

@AstraJens
Copy link
Author

AstraJens commented Dec 14, 2024

S:\AAA\samsunghealth>C:/Users/Jens/AppData/Local/Microsoft/WindowsApps/python3.11.exe
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import glob
glob.glob("com.samsung.health.floors_climbed.*.csv")
['com.samsung.health.floors_climbed.20241214121856.csv']
exit
Use exit() or Ctrl-Z plus Return to exit

glob.glob("com.samsung.health.floors_climbed.*.csv")
['com.samsung.health.floors_climbed.20241214121856.csv']

glob can see the right files....

no, all of the files are in this Directory

S:\AAA\samsunghealth

this was only the Python Path of the .exe file
C:/Users/Jens/AppData/Local/Microsoft/WindowsApps/python3.11.exe

@PhilippImhof
Copy link
Owner

no, all of the files are in this Directory

S:\AAA\samsunghealth

Yes, that's what I got from your listing above.

this was only the Python Path of the .exe file C:/Users/Jens/AppData/Local/Microsoft/WindowsApps/python3.11.exe

What I am talking about is this:

Bildschirmfoto 2024-12-14 um 17 16 14

This looks as if you were in C:\Users\Jens when you ran the scripts…

@AstraJens
Copy link
Author

AstraJens commented Dec 14, 2024

S:\AAA\samsunghealth>C:/Users/Jens/AppData/Local/Microsoft/WindowsApps/python3.11.exe activity.py
Traceback (most recent call last):
File "S:\AAA\samsunghealth\activity.py", line 184, in
data = merge_data(fetch_floor_data(), fetch_calorie_data(), fetch_activity_data())
^^^^^^^^^^^^^^^^^^^^^
File "S:\AAA\samsunghealth\activity.py", line 87, in fetch_activity_data
int(row["day_time"]) / 1000
^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '2023-12-30 00:00:00.000'

S:\AAA\samsunghealth>

###################################################################################

PS S:\aaa\samsunghealth> C:/Users/Jens/AppData/Local/Microsoft/WindowsApps/python3.11.exe activity.py
Traceback (most recent call last):
File "S:\aaa\samsunghealth\activity.py", line 184, in
data = merge_data(fetch_floor_data(), fetch_calorie_data(), fetch_activity_data())
^^^^^^^^^^^^^^^^^^^^^
File "S:\aaa\samsunghealth\activity.py", line 87, in fetch_activity_data
int(row["day_time"]) / 1000
^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '2023-12-30 00:00:00.000'
PS S:\aaa\samsunghealth>

@AstraJens
Copy link
Author

AstraJens commented Dec 14, 2024

How can i send my files to you? Discord, Teamspeak? On Discord i make a request if we can speak german ;-)

@PhilippImhof
Copy link
Owner

S:\AAA\samsunghealth>C:/Users/Jens/AppData/Local/Microsoft/WindowsApps/python3.11.exe activity.py Traceback (most recent call last): File "S:\AAA\samsunghealth\activity.py", line 184, in data = merge_data(fetch_floor_data(), fetch_calorie_data(), fetch_activity_data()) ^^^^^^^^^^^^^^^^^^^^^ File "S:\AAA\samsunghealth\activity.py", line 87, in fetch_activity_data int(row["day_time"]) / 1000 ^^^^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: '2023-12-30 00:00:00.000'

That's the other error. For whatever reason, the timestamp is not stored as a timestamp, but in ISO format.

@PhilippImhof
Copy link
Owner

@AstraJens Just to let you know that I will get back to you as soon as possible to schedule an exchange via Discord – auch auf Deutsch, wenn du möchtest...

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

Successfully merging a pull request may close this issue.

2 participants