[BUG] TypeError: descriptor 'replace' for 'datetime.datetime' objects doesn't apply to a 'NoneType' object
JackCaster opened this issue · 2 comments
Describe the bug
I cloned the repo and checkout the master branch. Unfortunately, I cannot convert my data as I encounter the error
TypeError: descriptor 'replace' for 'datetime.datetime' objects doesn't apply to a 'NoneType' object
Would you be able to help?
Logs
(project) root@1cd9702c5428:/workspaces/Hitrava# python Hitrava.py --file "data/Motion path detail data & description/motion path detail data.json" --log_level DEBUG
2023-04-03 12:59:08,125 - INFO - main - Hitrava version 5.1.1 (build 2207.2501) started with arguments ['--file', 'data/Motion path detail data & description/motion path detail data.json', '--log_level', 'DEBUG']
2023-04-03 12:59:08,125 - INFO - main - Running on Python version 3.8.16
2023-04-03 12:59:08,125 - INFO - parse - Parsing file <data/Motion path detail data & description/motion path detail data.json>
2023-04-03 12:59:08,126 - DEBUG - __init__ - New HiTrack activity to process <motion path detail data.json>
2023-04-03 12:59:08,241 - DEBUG - _close_file - HiTrack file <data/Motion path detail data & description/motion path detail data.json> closed
Traceback (most recent call last):
File "Hitrava.py", line 2165, in <module>
main()
File "Hitrava.py", line 2120, in main
_get_tz_aware_datetime(hi_activity.start, hi_activity.time_zone).strftime('%Y%m%d_%H%M%S'),
File "Hitrava.py", line 1935, in _get_tz_aware_datetime
utc_datetime = dts.replace(naive_datetime, tzinfo=tz.utc)
TypeError: descriptor 'replace' for 'datetime.datetime' objects doesn't apply to a 'NoneType' objectAdditional context
My Python environment definition:
(project) root@1cd9702c5428:/workspaces/Hitrava# conda list
# packages in environment at /opt/conda/envs/project:
#
# Name Version Build Channel
_libgcc_mutex 0.1 main
_openmp_mutex 5.1 1_gnu
black 23.3.0 pypi_0 pypi
ca-certificates 2023.01.10 h06a4308_0
certifi 2022.12.7 py38h06a4308_0
click 8.1.3 pypi_0 pypi
elementpath 4.1.0 pypi_0 pypi
flake8 6.0.0 pypi_0 pypi
ld_impl_linux-64 2.38 h1181459_1
libffi 3.4.2 h6a678d5_6
libgcc-ng 11.2.0 h1234567_1
libgomp 11.2.0 h1234567_1
libstdcxx-ng 11.2.0 h1234567_1
mccabe 0.7.0 pypi_0 pypi
mypy-extensions 1.0.0 pypi_0 pypi
ncurses 6.4 h6a678d5_0
openssl 1.1.1t h7f8727e_0
packaging 23.0 pypi_0 pypi
pathspec 0.11.1 pypi_0 pypi
pip 23.0.1 py38h06a4308_0
platformdirs 3.2.0 pypi_0 pypi
pycodestyle 2.10.0 pypi_0 pypi
pyflakes 3.0.1 pypi_0 pypi
python 3.8.16 h7a1cb2a_3
readline 8.2 h5eee18b_0
setuptools 65.6.3 py38h06a4308_0
sqlite 3.41.1 h5eee18b_0
tk 8.6.12 h1ccaba5_0
tomli 2.0.1 pypi_0 pypi
typing-extensions 4.5.0 pypi_0 pypi
wheel 0.38.4 py38h06a4308_0
xmlschema 2.2.2 pypi_0 pypi
xz 5.2.10 h5eee18b_1
zlib 1.2.13 h5eee18b_0
I see that you tried to call the script with the --file option and that you probably provided a valid json file instead.
python Hitrava.py --file "data/Motion path detail data & description/motion path detail data.json"
The --file option is used to convert legacy files generated on the mobile device itself.
To convert a json file, provide the --json option, as shown below.
python Hitrava.py --json "data/Motion path detail data & description/motion path detail data.json"
Thanks for closing the issue if it's solved. If not, do not hesitate to get in touch.
Excellent, thanks!