cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
252
Views
0
Helpful
4
Replies

AF_UNIX error from NC-get-config.py

chinkevi
Level 1
Level 1

hello,

 

i have AF_UNIX error when using NC-get-config.py.  I have windows and runing python ver 3.13.1.  Please advise if this can be fixed?

Traceback (most recent call last):
File "c:\python\nc-get-config.py", line 32, in <module>
from ncclient import manager
File "C:\Users\chint\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\ncclient\manager.py", line 21, in <module>
from ncclient import operations
File "C:\Users\chint\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\ncclient\operations\__init__.py", line 16, in <module>
from ncclient.operations.rpc import RPC, RPCReply, RPCError, RaiseMode, GenericRPC
File "C:\Users\chint\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\ncclient\operations\rpc.py", line 20, in <module>
from ncclient.transport import SessionListener
File "C:\Users\chint\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\ncclient\transport\__init__.py", line 20, in <module>
from ncclient.transport.unixSocket import UnixSocketSession
File "C:\Users\chint\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\ncclient\transport\unixSocket.py", line 18, in <module>
from socket import AF_UNIX, SOCK_STREAM
ImportError: cannot import name 'AF_UNIX' from 'socket' (C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.496.0_x64__qbz5n2kfra8p0\Lib\socket.py)

 

1 Accepted Solution

Accepted Solutions

Oh, my fault: The new version is not yet available on https://pypi.org/.

If you clone the repo and upgrade from there, you should be fine:

git clone https://github.com/ncclient/ncclient.git
cd ncclient
pip install -U .

HTH
Marcel

View solution in original post

4 Replies 4

Marcel Zehnder
Spotlight
Spotlight

Try to upgrade your ncclient package, there was a change introduced [1] to import the unix sockets only for non-windows systems:

pip install ncclient --upgrade

[1]: https://github.com/ncclient/ncclient/commit/ad88686f4772ae883109a8f97a26708a352b89b8

i have the same error after upgrade the ncclient package.

@chinkevi not an expert here, but based on your error, I think this is due to the AF_UNIX socket type, which is not natively supported on windows as this is a unix specific socket type for local inter-process communication that doesn't exist in the windows socket implementation.

A quick way around this would be to install WSL and run your Python script within the Linux environment or run a VM with Linux installed.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Oh, my fault: The new version is not yet available on https://pypi.org/.

If you clone the repo and upgrade from there, you should be fine:

git clone https://github.com/ncclient/ncclient.git
cd ncclient
pip install -U .

HTH
Marcel