Open abnerhale opened 1 year ago
I fixed the error with adding this code: from datetime import datetime now = datetime.now()
and changed the calls for datetime.now
milliseconds_since_last_run = datetime.now().timestamp() - float(last_execution_time)
The Python Script works fine in console now.
Now there is an error in the lua script.
I think it is something like the egion code, the latitude and longitude values are converted with commas instead dots.
I don't know how to fix this.
2,552803 LUA loading auto_reverse_geocode (git)
7,714602 LUA reverse geocoding IMG_4308.dng (51,816958333333,10,228855555556)
7,714683 LUA reverse geocode location prefix not configured. defaulting to 'where
7,714735 LUA reverse geocode nominatim language not configured. defaulting to 'en
7,714760 LUA /home/rwessel/.config/darktable/lua/contrib/reverse-geocode-nominatim.py --prefix where --lang en 51,816958333333 10,228855555556
Traceback (most recent call last):
File "/home/rwessel/.config/darktable/lua/contrib/reverse-geocode-nominatim.py", line 139, in
This is the output from the python script if the values changed manual with dots: /home/rwessel/.config/darktable/lua/contrib/reverse-geocode-nominatim.py --prefix where --lang en 51.816958333333 10.228855555556
location: where|Germany|Lower Saxony|Bad Grund|Harzhochstraße WeltWald Harz, Harzhochstraße, Bergstadt Bad Grund (Harz), Bad Grund, Landkreis Göttingen, Lower Saxony, 37539, Germany where|Germany|Lower Saxony|Bad Grund|Harzhochstraße WeltWald Harz, Harzhochstraße, Bergstadt Bad Grund (Harz), Bad Grund, Landkreis Göttingen, Lower Saxony, 37539, Germany
I made a very, very dirty hack in my lua script to replace the commas with dots in lat and long and it works for me. I think this isn't the correct solution. Perhaps you make a clean fix?
**-- Replace Commas with dots in latitude and longitude
local lat = string.gsub(image.latitude, ',', '.') local long = string.gsub(image.longitude, ',', '.') local cmd = nominatim_script.." --prefix "..location_prefix.." --lang "..nominatim_language.." "..lat..' '..long; -- local cmd = nominatim_script.." --prefix "..location_prefix.." --lang "..nominatim_language.." "..image.latitude..' '..image.longitude;** local location = run_command_and_get_stdout(cmd) lines = {} for s in location:gmatch("[^\r?\n]+") do table.insert(lines, s) end return lines end
I installed and configured lua and py script. I run the lua script via shortcut on lighttable . In console I get following error:
Traceback (most recent call last): File "/home/rwessel/.config/darktable/lua/contrib/reverse-geocode-nominatim.py", line 22, in
with open(timestampfile) as f:
^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/testtimestamp'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/rwessel/.config/darktable/lua/contrib/reverse-geocode-nominatim.py", line 26, in
last_execution_time = now
^^^
NameError: name 'now' is not defined. Did you mean: 'pow'?
Any suggestions?
Best regards