3

Description:

I'm using Vscode Studio for python coding, I've installed every extension related to python and I wanna use Jupyter. I'm experiencing no problem with importing packages or running code but when I try to grab the input from the user it throws me an error stating 'StdinNotImplementedError: raw_input was called, but this frontend does not support input requests.' which I don't find using the console.

[Image Error] https://i.sstatic.net/BDUC5.jpg

Error

StdinNotImplementedError                  Traceback (most recent call last)
 in 
      9 while 1:
     10     #ask for new item
---> 11     new_item=input("> ")
     12     #add new items to our list
     13     shopping_list.append(new_item)

~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ipykernel\kernelbase.py in raw_input(self, prompt)
    846         if not self._allow_stdin:
    847             raise StdinNotImplementedError(
--> 848                 "raw_input was called, but this frontend does not support input requests."
    849             )
    850         return self._input_request(str(prompt),

StdinNotImplementedError: raw_input was called, but this frontend does not support input requests.

Steps Taken:

  1. Use the raw_input function instead of input.
  2. Install and uninstall python and jupyter extension.
  3. Checked the version of jupyter notebook --version (5.7.4) and python -m ipykernel --version (7.2.0).
  4. Restarted kernel but encounter the same error.

Observation: The issue is not replicable when the code is executed with python integrated terminal

Please let me know if there is setting which I'm missing or is this a bug.

3
  • Please ask question in proper format. Commented Dec 24, 2018 at 7:53
  • Here is a similar question that might help. It's for java but that shouldn't be relevant here. Commented Dec 24, 2018 at 8:01
  • @Joakim Danielson, Thanks but this issue is only with vs code studio when using jupyter functionality and only when somebody takes input using input command. Commented Dec 24, 2018 at 8:13

1 Answer 1

2

Ctrl + Shift + D

Environment -> Python This creates launch.json file within a .vscode directory in the current directory

Paste the following json:

{
"version": "0.2.0",
"configurations": [
    {
        "name": "Python",
        "type": "python",
        "request": "launch",
        "stopOnEntry": true,
        "pythonPath": "${config.python.pythonPath}",
        "program": "${file}",
        "debugOptions": [
            "WaitOnAbnormalExit",
            "WaitOnNormalExit",
            "RedirectOutput"
        ],
        "console": "integratedTerminal"
    }
]}

Save the file and open python script in the editor Start without debugging

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.