LookupError: 'hex' is not a text encoding; use codecs.encode()
AntouanK opened this issue · 10 comments
I pulled the latest in the linux vm.
-> % git pull
Updating 20e9888..5332123
Fast-forward
f5fpc-client.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
antouank@antergos-vm [09:53:26] [~/_REPOS_/docker-f5fpc] [master]
-> % sudo ./f5fpc-client.py connect.xxxxxx.com xxxxxxx
Enter your VPN password:
Traceback (most recent call last):
File "./f5fpc-client.py", line 155, in <module>
sys.exit(main())
File "./f5fpc-client.py", line 63, in main
'HEXPASSWORD': password.encode('hex')
LookupError: 'hex' is not a text encoding; use codecs.encode() to handle arbitrary codecs
python version
antouank@antergos-vm [09:57:04] [~/_REPOS_/docker-f5fpc] [master]
-> % python --version
Python 3.6.0
antouank@antergos-vm [09:57:08] [~/_REPOS_/docker-f5fpc] [master]
-> % python2 --version
Python 2.7.13
antouank@antergos-vm [09:57:11] [~/_REPOS_/docker-f5fpc] [master]
-> % sudo pip install -r requirements.txt
/usr/lib/python3.6/site-packages/requests/packages/urllib3/contrib/socks.py:31: DependencyWarning: SOCKS support in urllib3 requires the installation of optional dependencies: specifically, PySocks. For more information, see https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies
DependencyWarning
Requirement already satisfied: docker==2.2.1 in /usr/lib/python3.6/site-packages (from -r requirements.txt (line 1)) (2.2.1)
Requirement already satisfied: requests==2.11.1 in /usr/lib/python3.6/site-packages (from -r requirements.txt (line 2)) (2.11.1)
Requirement already satisfied: websocket-client>=0.32.0 in /usr/lib/python3.6/site-packages (from docker==2.2.1->-r requirements.txt (line 1)) (0.48.0)
Requirement already satisfied: six>=1.4.0 in /usr/lib/python3.6/site-packages (from docker==2.2.1->-r requirements.txt (line 1)) (1.10.0)
Requirement already satisfied: docker-pycreds>=0.2.1 in /usr/lib/python3.6/site-packages (from docker==2.2.1->-r requirements.txt (line 1)) (0.3.0)
Seems to be a python3 compatibility issue, support for hex encoding is gone.
@MatthiasLohr Not sure if it would help, but wouldn't it be better to put all the python parts in the docker container?
So you can use an image that has already python installed, and that way you control the version/dependencies, and the user does not have to install some specific python version/library.
If you take a look into the python code, cou can see that this python script is doing some actions on the host system. So i have no idea how to put that into the container.
Oh I see.
I don't know python at all, so I have no idea what it does.
Just curious, by passing the host's network to the container (https://docs.docker.com/network/host/), isn't it enough so you can do all the actions from within the container?
In any case, if there's a simple way to fix that error, let me know what I should try.
@MatthiasLohr Hey Matthias. Is there any update on this encoding issue?
Not yet. I will work on that as soon as I find the time for that. Sorry for the delay.
No worries at all.
Let me know if I can help testing anything.
@AntouanK, could you please checkout the new branch and test, if it's working now? Thx!
@MatthiasLohr Yes, I now get the "login denied" error, it doesn't throw the python error anymore. 👍