'unknown encoding: idna' on socket.connect()

Hi,

On a CP X4 I am running a Python routine that attempts to open a socket to port 502 on localhost (to the IA module) and read from it.

A standalone test version works fine.

Called from a larger program (which is also doing some HTTP POSTing to an external server), the same code gets an ‘unknown encoding: idna’ on socket.connect().

Appears I am sensitizing something that causes the idna encoding error.

There was a previous post by someone encountering this error using httplib. Solution was to use digi_httplib. That doesn’t seem to be what is happening here.

Anyone seen such behavior?

Thanks,

  • C

I seem to have solved this problem. On a hunch, I checked the type of the host name being presented to the socket connect. It was unicode. I made it str, and now the socket opens without problem.

  • C

http://forums.digi.com/support/forum/viewthread_thread,8295

see above --^

I believe the response has now moved to here…and thank you to all involved in solving and writing about this!
https://forums.digi.com/8785/problem-using-httplib-to-post-remote-server-httplib-request