-
Notifications
You must be signed in to change notification settings - Fork 184
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
Python 3.4 stream readline uses bytes instead of string #58
Conversation
Never mind, this is wrong. Consider this a bug report, but my fix is not correct... |
1 similar comment
…es python 3.4 compatibility.
Ok, I've really fixed this now. This is 100% confirmed working in python 3.4, but I have no idea about other versions. Please realise that your build bot seems to be not working, because it accepted both my previous 'fixes'. |
I've made a gist to illustrate the problem: https://gist.github.com/Dutchy-/c87b1c27b9c08fb0323c There are several solutions:
One of those may help in keeping things more compatible than they are now. |
i'll check this out asap. |
Hello, this fix gives error in py3.8: Traceback (most recent call last): |
but the issue got fixed in: https://github.com/savon-noir/python-libnmap/pull/68/files thanks to both of you @Dutchy- @rcarrillo (sorry guys for that late update, i'm in a full review/clean-up process of this lib :) |
In my previous pull request, I only fix the obvious crash. However, there was more. I'm not 100% sure of the problem and the solution, but the current code works for me.
In python 3.4, the readline used for streams seems to return an empty byte array instead of an empty string. Without this, it keeps looping for streams.
My fix simply replaces '' with bytes(), however I'm not convinced this works for python versions other than 3.4. We'll have the build bot check it out first. If this doesn't work for the other versions, I'm not sure I can fix it, I might need some help.
My theory is that this was never caught because all the test cases run from files instead of from an actual nmap process.
My context and use case was https://groups.google.com/forum/#!msg/home-assistant-dev/hKcH32MzQvs/kF98gmFCIUQJ and I'm hoping for a new libnmap release soon :)