Skip to content

NameError: name 'raw_input' is not defined #83

Open
@plandolt

Description

@plandolt

Project Details

  • Version: ansible-role-prompt v0.3.0
  • Python Version: 3.7.3
  • Ansible Version: 2.7.10
  • Operating System: macOS

Error on every prompt attempt

The full traceback is:
Traceback (most recent call last):
  File "/usr/local/Cellar/ansible/2.7.10/libexec/lib/python3.7/site-packages/ansible/executor/task_executor.py", line 140, in run
    res = self._execute()
  File "/usr/local/Cellar/ansible/2.7.10/libexec/lib/python3.7/site-packages/ansible/executor/task_executor.py", line 612, in _execute
    result = self._handler.run(task_vars=variables)
  File "/Users/patricklandolt/.ansible/roles/andrewvaughan.prompt/action_plugins/prompt.py", line 96, in run
    return self._prompt(result, args['msg'])
  File "/Users/patricklandolt/.ansible/roles/andrewvaughan.prompt/action_plugins/prompt.py", line 210, in _prompt
    var = raw_input(askstr)
NameError: name 'raw_input' is not defined

fatal: [staging.radiant.artack.ch]: FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}

I think this is the problem of using python3 as they removed raw_input (ref: https://www.python.org/dev/peps/pep-3111/)

Activity

mx781

mx781 commented on Oct 14, 2020

@mx781

Doing manual installation as per the plugin's README and then changing raw_input to input fixes this for Python 3. @andrewvaughan if you're still maintaining this happy to file a PR that makes it cross-compatible.

cosaintneal

cosaintneal commented on Mar 24, 2021

@cosaintneal

Installing via ansible-galaxy, then changing raw_input to input fixes this for Python 3. I agree with @mx781 that this fix would benefit the community, can we make a PR @andrewvaughan?

andrewvaughan

andrewvaughan commented on Mar 26, 2021

@andrewvaughan
Owner

Hey all - I'm a little tight on time right now (having my first kid!) but I'm still supporting this project. If anyone wishes to submit a PR I'll definitely make sure it gets in.

added a commit that references this issue on Jun 17, 2022
e53c293
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @plandolt@andrewvaughan@mx781@cosaintneal

      Issue actions

        NameError: name 'raw_input' is not defined · Issue #83 · andrewvaughan/ansible-role-prompt