cmer/lg-tv-control-macos

Error running the latest script (20230407)

Closed this issue · 3 comments

Here' my error log after running the latest version (20230407)

2023-04-09 00:09:34: 00:09:34 ERROR: LuaSkin: hs.caffeinate.watcher callback: /Users/xxx/.hammerspoon/lgtv.lua:60: attempt to call a nil value (global 'file_exists')
stack traceback:
/Users/xxx/.hammerspoon/lgtv.lua:60: in function 'lgtv_disabled'
/Users/xxx/.hammerspoon/lgtv.lua:80: in function </Users/xxx/.hammerspoon/lgtv.lua:77>
2023-04-09 00:09:36: 00:09:36 ERROR: LuaSkin: hs.caffeinate.watcher callback: /Users/xxx/.hammerspoon/lgtv.lua:60: attempt to call a nil value (global 'file_exists')
stack traceback:
/Users/xxx/.hammerspoon/lgtv.lua:60: in function 'lgtv_disabled'
/Users/xxx/.hammerspoon/lgtv.lua:80: in function </Users/xxx/.hammerspoon/lgtv.lua:77>
2023-04-09 00:09:37: 00:09:37 ERROR: LuaSkin: hs.caffeinate.watcher callback: /Users/xxx/.hammerspoon/lgtv.lua:60: attempt to call a nil value (global 'file_exists')
stack traceback:
/Users/xxx/.hammerspoon/lgtv.lua:60: in function 'lgtv_disabled'
/Users/xxx/.hammerspoon/lgtv.lua:80: in function </Users/xxx/.hammerspoon/lgtv.lua:77>
2023-04-09 00:09:38: 00:09:38 ERROR: LuaSkin: hs.caffeinate.watcher callback: /Users/xxx/.hammerspoon/lgtv.lua:60: attempt to call a nil value (global 'file_exists')
stack traceback:
/Users/xxx/.hammerspoon/lgtv.lua:60: in function 'lgtv_disabled'
/Users/xxx/.hammerspoon/lgtv.lua:80: in function </Users/xxx/.hammerspoon/lgtv.lua:77>
2023-04-09 00:09:44: 00:09:44 ERROR: LuaSkin: hs.caffeinate.watcher callback: /Users/xxx/.hammerspoon/lgtv.lua:60: attempt to call a nil value (global 'file_exists')
stack traceback:
/Users/xxx/.hammerspoon/lgtv.lua:60: in function 'lgtv_disabled'
/Users/xxx/.hammerspoon/lgtv.lua:80: in function </Users/xxx/.hammerspoon/lgtv.lua:77>
2023-04-09 00:09:49: 00:09:49 ERROR: LuaSkin: hs.caffeinate.watcher callback: /Users/xxx/.hammerspoon/lgtv.lua:60: attempt to call a nil value (global 'file_exists')
stack traceback:
/Users/xxx/.hammerspoon/lgtv.lua:60: in function 'lgtv_disabled'
/Users/xxx/.hammerspoon/lgtv.lua:80: in function </Users/xxx/.hammerspoon/lgtv.lua:77>
2023-04-09 00:10:10: 00:10:10 ERROR: LuaSkin: hs.caffeinate.watcher callback: /Users/xxx/.hammerspoon/lgtv.lua:60: attempt to call a nil value (global 'file_exists')
stack traceback:
/Users/xxx/.hammerspoon/lgtv.lua:60: in function 'lgtv_disabled'
/Users/xxx/.hammerspoon/lgtv.lua:80: in function </Users/xxx/.hammerspoon/lgtv.lua:77>
2023-04-09 00:10:13: 00:10:13 ERROR: LuaSkin: hs.caffeinate.watcher callback: /Users/xxx/.hammerspoon/lgtv.lua:60: attempt to call a nil value (global 'file_exists')
stack traceback:
/Users/xxx/.hammerspoon/lgtv.lua:60: in function 'lgtv_disabled'
/Users/xxx/.hammerspoon/lgtv.lua:80: in function </Users/xxx/.hammerspoon/lgtv.lua:77>

i did not write the code, but this is my solution

if you change line 60 to "return false" instead of "return file_exists("./disable_lgtv")" then it will also return false and continue with the scripts, but i am not sure what that changes or what problems it can cause in the future, but i just got a LG C2 tv so i just got it working, but again i didnt write the code, so idk what it will effect.

This is because there is no file_exists function in current version. I fixed the issue and sent a PR #7
Hope the owner of this project have a time to review and merge my PR. 😄

BTW @cmer Thank you so much for sharing this great project. 👍

cmer commented

Thank you so much! I will review and approve shortly.

For context, I have this function to check if a file exist because I sync my dotfiles across many computers. I have .disable_lgtv on my computers that are not hooked up to the TV to ensure they don't control it needlessly.