-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
python3: UnicodeDecodeError on calling socket.gethostbyaddr("hostname") #1311
Comments
will look into it; |
@FlorianFieber Mind to retry ? If this re-appears I'll dig deeper into it, but with this one, it seems like it was either a |
I happened to build and flash the latest trunk with NLS (full language support) for mips yesterday. The problem persists:
|
Ok. Thanks |
Right; so this is a heart-beat message (i.e. to let people know I haven't forgot about this). Last time I checked this (and did not reproduce it) was on my home network. |
I was able to work around this by making sure my I changed my default
to
I'm not sure what was invalid about 127.0.0.1 as it responds if queried. |
@FlorianFieber this looks a lot like an issue that's more related to Python3 or libc
|
I'm sorry for the late reply. Sadly, I don't have access to a flashable OpenWRT router right now to test it. |
no worries :) |
Hi guys, just posting to confirm that Florian is not the only one experiencing this problem. Under OpenWrt Chaos Calmer 15.05.1, the gethostbyaddr() (and as a consequence getfqdn() and much more) in standard Python 3.4 from opkg will crash with a UnicodeDecodeError for almost address: % python3.4 -c "import _socket; print(_socket.gethostbyaddr('google.com'))" The sole exception I found was for localhost: If I was to guess, the reason is that the series of bytes 127, 0, 0, 1 is valid ASCII (and hence Unicode) while any IP address which contains any byte with the high bit set may not be. |
Could have to do with the locale setting. See nice article in LWN https://lwn.net/Articles/741176/
Paul
… Op 23 dec. 2017, om 13:53 heeft Carl Edman ***@***.***> het volgende geschreven:
Hi guys, just posting to confirm that Florian is not the only one experiencing this problem. Under OpenWrt Chaos Calmer 15.05.1, the gethostbyaddr() (and as a consequence getfqdn() and much more) in standard Python 3.4 from opkg will crash with a UnicodeDecodeError for almost address:
python3.4 -c "import _socket; print(_socket.gethostbyaddr('google.com'))"
Traceback (most recent call last):
File "", line 1, in
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf8 in position 2: invalid start byte
The sole exception I found was for localhost:
python3.4 -c "import _socket; print(_socket.gethostbyaddr('localhost'))"
('localhost', [], ['127.0.0.1'])
If I was to guess, the reason is that the series of bytes 127, 0, 0, 1 is valid ASCII (and hence Unicode) while any IP address which contains any byte with the high bit set may not be.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@CarlEdman I don't know if ChaosCalmer is supported anymore, and I can't find a build infrastructure that would build another package. If this issue is still of interest for CC, I could try to see about fixing it. |
3.4.7 is the more recent from the 3.4.x series 3.6.4 is the more recent one |
@commodo Thanks for the response! I'm planning to upgrade to a new version one of these days anyways. If it requires more than minimal work on your part, please don't bother to fix my issue until I can confirm it happens on a current version of OpenWRT (hopefully after the eagerly awaited LEDE merger; that is still happening, right?). |
First of all: Happy New Year :) I tried upgrading 3.4.3 to 3.4.7 and applying the patch from : https://bugs.python.org/issue26227 One next thing I could try, is to upgrade to 3.6.4 and try it, but I'm not sure about upgrading it officially into the 15.05 version. |
@CarlEdman
I just noticed that uClibc is used vs musl in OpenWrt 15.05. I guess at this point, a full system upgrade is required to make this work. |
Just a quick update in case anybody is interested. I just bought a new router (Linksys WRT3200ACM, $119 refurb from Amazon) which actually has functional WiFi under OpenWRT and installed the latest stable firmware (LEDE Reboot 17.01.4 r3560-79f57e422d / LuCI lede-17.01 branch (git-18.061.17832-d092772) ) and python 3.6.0. And now the same code works just fine:
|
ah ; 3 years later here :) |
I've stumbled over an UnicodeDecodeError which backtracks to
socket.getfqdn()
callingsocket.gethostbyaddr("hostname")
.Python3:
Whereas it's working in Python2:
The text was updated successfully, but these errors were encountered: