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

AttributeError: module 'ssl' has no attribute 'wrap_socket' #32

Closed
Krizid opened this issue Dec 12, 2023 · 12 comments
Closed

AttributeError: module 'ssl' has no attribute 'wrap_socket' #32

Krizid opened this issue Dec 12, 2023 · 12 comments

Comments

@Krizid
Copy link

Krizid commented Dec 12, 2023

hi, getting this error with the new setup

lgtv auth 10.0.0.90 MyTV --ssl
Traceback (most recent call last):
File "/Users/name/.local/bin/lgtv", line 10, in
sys.exit(main())
^^^^^^
File "/Users/name/Library/Application Support/pipx/venvs/lgtv/lib/python3.12/site-packages/LGTV/init.py", line 137, in main
ws.connect()
File "/Users/name/Library/Application Support/pipx/venvs/lgtv/lib/python3.12/site-packages/ws4py/client/init.py", line 214, in connect
self.sock = ssl.wrap_socket(self.sock, **self.ssl_options)
^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'

@syncr
Copy link

syncr commented Dec 12, 2023

Same issue

@cmer
Copy link
Owner

cmer commented Dec 14, 2023

I completely messed up a couple of days ago. It's been resolved.

Also make sure you install the latest version of the LG TV Python scripts.

@cmer cmer closed this as completed Dec 14, 2023
@syncr
Copy link

syncr commented Dec 16, 2023

I executed a --force installation of the LGWebORemote files but am still getting the same error as above. Is there something I've missed or can try? Thanks in advance.

@cmer
Copy link
Owner

cmer commented Dec 17, 2023

Looks like this is the issue: klattimer/LGWebOSRemote#140

@syncr
Copy link

syncr commented Dec 17, 2023

Ok thanks. Standing by till that gets resolved. 👍

@cmer
Copy link
Owner

cmer commented Dec 19, 2023

Until LGWebOSRemote fixes the issue, I recommend you use Python 3.6 instead of the latest.

pipx uninstall LGTV
brew uninstall --ignore-dependencies python
brew uninstall --force [email protected]
brew install [email protected]

Then reinstall pipx and LGTV.

@Aurshur
Copy link

Aurshur commented Dec 20, 2023

Until LGWebOSRemote fixes the issue, I recommend you use Python 3.6 instead of the latest.

pipx uninstall LGTV
brew uninstall --ignore-dependencies python
brew uninstall --force [email protected]
brew install [email protected]

Then reinstall pipx and LGTV.

Unfortunately that's not working for me - I get the following:

% brew install [email protected]
Warning: No available formula with the name "[email protected]". Did you mean [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] or python-yq?
==> Searching for similarly named formulae and casks...
==> Formulae
[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] python-yq

@MattCis
Copy link

MattCis commented Jan 6, 2024

@Aurshur and it will not work. Installing (or reinstalling) pipx will automatically install python 3.12 - which is part of the problem. I am trying to come up with some workaround, but I doubt I will - all of this is too complex to me at the moment.

@Aurshur
Copy link

Aurshur commented Jan 7, 2024

@Aurshur and it will not work. Installing (or reinstalling) pipx will automatically install python 3.12 - which is part of the problem. I am trying to come up with some workaround, but I doubt I will - all of this is too complex to me at the moment.

I ran into the same issue - but actually got it working in the end as I used pip instead of pipx to install.

@MattCis
Copy link

MattCis commented Jan 10, 2024

@Aurshur and it will not work. Installing (or reinstalling) pipx will automatically install python 3.12 - which is part of the problem. I am trying to come up with some workaround, but I doubt I will - all of this is too complex to me at the moment.

I ran into the same issue - but actually got it working in the end as I used pip instead of pipx to install.

I managed to overcome this as well, but pip3 wasn't the solution - it was showing different errors when installing LGTV.

I somehow managed to use pipx and go through the whole process, despite various errors popping-up in the meantime. The sleep/wake-up function was working flawlessly for those few days, until yesterday. My M1 Mini received the update of mac os. Now, Hammerspoon is "not responding" when the lgtv_init script is loaded and the functionality is gone. Restarting doesn't help. I am not able to tell where is the matter, but it seems that some "element" of the whole puzzle changes and the script is not correct/compatible anymore.

I am learning ver hard way, what actually means that "TV is not going to be a monitor" ;)

This is my console. No errors, but tries to load the "external headphones" (słuchawki zewnętrzne) over and over. I have my M1 Mini connected through mini jack to the stereo system.

2024-01-10 16:58:27: -- Lazy extension loading enabled
2024-01-10 16:58:27: -- Loading ~/.hammerspoon/init.lua
2024-01-10 16:58:27: TV name: MyTV
2024-01-10 16:58:27: TV input: HDMI_2
2024-01-10 16:58:27: LGTV path: ~/.local/bin/lgtv
2024-01-10 16:58:27: LGTV command: ~/.local/bin/lgtv --ssl --name MyTV
2024-01-10 16:58:27: App ID: com.webos.app.hdmi2
2024-01-10 16:58:27: lgtv_disabled: false
2024-01-10 16:58:27: Executing command: ~/.local/bin/lgtv --ssl --name MyTV swInfo
2024-01-10 16:59:42:
2024-01-10 16:59:42: Executing command: ~/.local/bin/lgtv --ssl --name MyTV getForegroundAppInfo
2024-01-10 17:00:57:
2024-01-10 17:00:57: -- Loading extension: screen
2024-01-10 17:00:57: Connected screens: { [1] = hs.screen: LG TV SSCR2 (0x60000282d538),}
2024-01-10 17:00:57: TV is connected? true
2024-01-10 17:00:57: -- Loading extension: caffeinate
2024-01-10 17:00:58: -- Loading extension: eventtap
2024-01-10 17:00:58: -- Done.
2024-01-10 17:01:05: -- Loading extension: audiodevice
2024-01-10 17:01:05: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:07: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:10: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:10: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:24: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:24: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:24: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:25: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:30: Słuchawki zewnętrzne is the current audio device

.

@Aurshur
Copy link

Aurshur commented Jan 11, 2024

@Aurshur and it will not work. Installing (or reinstalling) pipx will automatically install python 3.12 - which is part of the problem. I am trying to come up with some workaround, but I doubt I will - all of this is too complex to me at the moment.

I ran into the same issue - but actually got it working in the end as I used pip instead of pipx to install.

I managed to overcome this as well, but pip3 wasn't the solution - it was showing different errors when installing LGTV.

I somehow managed to use pipx and go through the whole process, despite various errors popping-up in the meantime. The sleep/wake-up function was working flawlessly for those few days, until yesterday. My M1 Mini received the update of mac os. Now, Hammerspoon is "not responding" when the lgtv_init script is loaded and the functionality is gone. Restarting doesn't help. I am not able to tell where is the matter, but it seems that some "element" of the whole puzzle changes and the script is not correct/compatible anymore.

I am learning ver hard way, what actually means that "TV is not going to be a monitor" ;)

This is my console. No errors, but tries to load the "external headphones" (słuchawki zewnętrzne) over and over. I have my M1 Mini connected through mini jack to the stereo system.

2024-01-10 16:58:27: -- Lazy extension loading enabled
2024-01-10 16:58:27: -- Loading ~/.hammerspoon/init.lua
2024-01-10 16:58:27: TV name: MyTV
2024-01-10 16:58:27: TV input: HDMI_2
2024-01-10 16:58:27: LGTV path: ~/.local/bin/lgtv
2024-01-10 16:58:27: LGTV command: ~/.local/bin/lgtv --ssl --name MyTV
2024-01-10 16:58:27: App ID: com.webos.app.hdmi2
2024-01-10 16:58:27: lgtv_disabled: false
2024-01-10 16:58:27: Executing command: ~/.local/bin/lgtv --ssl --name MyTV swInfo
2024-01-10 16:59:42:
2024-01-10 16:59:42: Executing command: ~/.local/bin/lgtv --ssl --name MyTV getForegroundAppInfo
2024-01-10 17:00:57:
2024-01-10 17:00:57: -- Loading extension: screen
2024-01-10 17:00:57: Connected screens: { [1] = hs.screen: LG TV SSCR2 (0x60000282d538),}
2024-01-10 17:00:57: TV is connected? true
2024-01-10 17:00:57: -- Loading extension: caffeinate
2024-01-10 17:00:58: -- Loading extension: eventtap
2024-01-10 17:00:58: -- Done.
2024-01-10 17:01:05: -- Loading extension: audiodevice
2024-01-10 17:01:05: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:07: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:10: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:10: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:24: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:24: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:24: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:25: Słuchawki zewnętrzne is the current audio device.
2024-01-10 17:01:30: Słuchawki zewnętrzne is the current audio device

.

EDIT I may have a fix. Still tinkering but insert the following at the top of .init.lua:

print(hs.location.get())

Then reload the config and go to Security and Privacy in System settings - Location Services and give hammer spoon permission (it should now be listed).

Seems to be working so far on my end!

Sadly, I am finding myself in the exact same situation. Pretty frustrating that in the end it worked flawlessly for only a matter of days just to be defeated by a MacOS update.

@MattCis
Copy link

MattCis commented Jan 11, 2024

@Aurshur I appreciate so much all your support!

My issue was of other sort. Very trivial. I noticed that, for unknown reason, TV disconnected from my WiFi. It didn't want to connect back (to both 2.4 and 5kHz), just showing generic error message. I must power cycle the router and restart my network. I found on the Internet, that unfortunately some of LG C2 have that kind of issue and frequently drops the connection. I will be observing my TV and see if/how often this will repeat.

After reconnecting to the WiFi, script started to work again (which is logical).

Yesterday I switched the connection to HDMI 2.1 cable and usb c->hdmi converter, to have 120Hz, RGB, 4:4:4 mode.
My latest issue is that the screen (after few hours of being off) wakes up, but only to the TV screen saver (art gallery) and I have to wait couple of minutes for the converter to "pick up" the signal and actually start showing my macos desktop. Reconnecting adapter works, but of course I don't want to reconnect adapter everytime the issue appears.

However, I am only mentioning this "by the way". This isn't the script's issue and most probably won't be possible to solve by script, since it's coming most probably from the macos itself/converter.

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

No branches or pull requests

5 participants