Skip to content
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

Jupyterhub/lab ; Python 3.6 : using #vault_password throws type error #81

Open
sconburg opened this issue Feb 22, 2019 · 3 comments
Open
Assignees

Comments

@sconburg
Copy link

Describe the bug

In the case of running ansible_kernel on a python3.6 install of jupyterhub/lab; when using the #vault_password keyword the following error is raised.

TypeError                                 Traceback (most recent call last)
<ipython-input-1-2c7e8874a5d5> in <module>
      1 import ansible_kernel.widgets
      2 style = {'description_width': 'initial'}
----> 3 ansible_kernel.widgets.VaultPassword(description='Vault Password:', style=style)
TypeError: a bytes-like object is required, not 'str'

To Reproduce
Dockerfile below:

FROM centos:latest

RUN curl -sL https://rpm.nodesource.com/setup_10.x | bash - && \
    yum -y install https://centos7.iuscommunity.org/ius-release.rpm && \
    yum -y install epel-release && \
    yum -y install python36u python36u-libs python36u-devel python36u-pip nodejs gcc && \
    pip3.6 --cert /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem install --upgrade pip

RUN pip3.6 install jupyterhub jupyterlab notebook && \
    pip3.6 install ansible ansible-kernel ipython && \
    pip3.6 install ipywidgets && \
    npm install -g configurable-http-proxy

RUN jupyter labextension install @jupyterlab/hub-extension && \
    jupyter labextension install @jupyter-widgets/jupyterlab-manager &&\
    jupyter nbextension enable --py widgetsnbextension --sys-prefix && \
    python3.6 -m ansible_kernel.install

RUN useradd -ms /bin/bash -p "$(openssl passwd -1 test)" test 

RUN echo $'import os \n\
c = get_config() \n\
c.Spawner.cmd = [\'jupyter-labhub\'] \n' > jupyterhub_config.py

CMD jupyterhub -f jupyterhub_config.py

Spin up container with:

docker build --rm -f "bug_reproduce\Dockerfile" -t bug_reproduce:latest bug_reproduce
docker run -p 8000:8000 -d -it --name jupyter_bug bug_reproduce
  • Log in to container via Chrome with user test, password test.
  • Open a new Ansible Project.
  • Enter #vault_password into cell.
  • Execute cell.

Expected behavior
Interactive widget should appear as per second screenshot

Screenshots
This is the error which is seen within the ansible_kernel.

image

This is what should be seen (this example is run directly from python kernel).

image

Desktop (please complete the following information):

  • OS: CentOS Linux release 7.6.1810 (Core)
  • Browser: Chrome
  • Version: 72.0.3626.109 (Official Build) (64-bit)
  • Jupyter Notebook Version: 5.7.4
  • Jupyter Lab Version: 0.35.4
  • Jupyter Hub Version: 0.9.4

Additional Information
Not sure if it is relevant but running the python snippet shown above in the second screenshot throws the same error when run with #python keyword on ansible_kernel.

@benthomasson benthomasson self-assigned this Feb 25, 2019
@benthomasson
Copy link
Contributor

Thanks @sconburg for submitting this issue. I'll take a look at it under Jupyter lab. I'll work on Jupyter Lab integration for the next release.

@philipsd6
Copy link

FWIW, this isn't a JupyterLab problem -- this issue applies to the basic Jupyter Notebook as well.

jldowns pushed a commit to jldowns/ansible-jupyter-kernel that referenced this issue Aug 22, 2021
jldowns pushed a commit to jldowns/ansible-jupyter-kernel that referenced this issue Aug 22, 2021
@almereyda
Copy link

@jldowns has a fix in jldowns@a89ab75

Would this be useful and non-invasive enough to take in here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants