OSError: [WinError 10022] An invalid argument was supplied

813 views
Skip to first unread message

kristian.hers...@gmail.com

unread,
Feb 26, 2017, 7:42:46 PM2/26/17
to SoCo - Sonos Controller
Hi all

When searching google it looks like the issue I'm having has been resolved, but still I'm hitting it. 

When doing a:

for zone in soco.discover():
     print(zone.player_name)

I'm getting the following message:

Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    for zone in soco.discover():
  File "C:\Python\Python36-32\lib\site-packages\soco\discovery.py", line 123, in discover
    list(s.getsockname()[0] for s in _sockets))
  File "C:\Python\Python36-32\lib\site-packages\soco\discovery.py", line 123, in <genexpr>
    list(s.getsockname()[0] for s in _sockets))
OSError: [WinError 10022] An invalid argument was supplied


The strangest thing is, that I got it to work when upgrading from 0.11 to 0.12, then I left my PC to get some dinner and when returning back it now gives the same error again. Very stange.
I can access and control my Sonos speakers when trying direct towards their IP's with.

>>> from soco import SoCo
>>> my_zone = SoCo('xxx.xxx.x.xxx')
>>> my_zone.player_name

Hope that someone has some insight on what might be wrong here.

Best regards, 
Kristian

Jim Stuhlmacher

unread,
Mar 1, 2017, 2:19:39 PM3/1/17
to SoCo - Sonos Controller
There is an issue for this (https://github.com/SoCo/SoCo/issues/445).  It is supposed to be fixed in development version.  As a workaround, you can pass the IP address of your PC in the call to discover().  For example: soco.discover(interface_addr='192.168.1.1')

kristian.hers...@gmail.com

unread,
Mar 3, 2017, 10:01:15 AM3/3/17
to SoCo - Sonos Controller
Thanks for the workaround Jim, it will try it later. I'm still a bit baffled that I got it to work a few times and that it is now not working. 

I will look forward to the next release :)

Orph

unread,
Aug 6, 2017, 12:21:10 PM8/6/17
to SoCo - Sonos Controller
Hi Jim, 

When I add the IP, the object seems not to be iterable

TypeError: 'NoneType' object is not iterable

devices = soco.discover(interface_addr="192.168.1.212")

for device in devices:
# subscribe to both av and render events for each sonos device
sub_list.append(device.avTransport.subscribe())
sub_list.append(device.renderingControl.subscribe())

Would you have any idea why ?

In advance, thanks.
Reply all
Reply to author
Forward
0 new messages