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

NameError: name 'raw_input' is not defined #83

Open
plandolt opened this issue Apr 26, 2019 · 3 comments · May be fixed by #85
Open

NameError: name 'raw_input' is not defined #83

plandolt opened this issue Apr 26, 2019 · 3 comments · May be fixed by #85

Comments

@plandolt
Copy link

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/)

@mx781
Copy link

mx781 commented Oct 14, 2020

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
Copy link

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
Copy link
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.

tekkamanendless added a commit to tekkamanendless/ansible-role-prompt that referenced this issue Jun 17, 2022
This fixes andrewvaughan#83.  In Python3, `raw_input` is not available, but
`input` does pretty much the same thing.
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

Successfully merging a pull request may close this issue.

4 participants