3

I have following line of code to accept Identifiers:

security = input("Insert ID")

This works great on my python. However when I send the notebook to a colleague, this error occurs:

StdinNotImplementedError                  Traceback (most recent call last)
<ipython-input-1-324a5244d6ce> in <module>
      1 ## Insert NIM/PREL or active Bond here
----> 2 security = input("Insert Bond ID or Figi # -- e.x. 025816CH0 Corp, BBG012JJ3534 ") #BQ3149326 credit ag #BQ4561651 jag #025816CH0 AMEX #BR0344159 PREL EXAMPLE #BR1139871 PREL INR

C:\axy\py\environments\quant2\lib\site-packages\ipykernel\kernelbase.py in raw_input(self, prompt)
    853         if not self._allow_stdin:
    854             raise StdinNotImplementedError(
--> 855                 "raw_input was called, but this frontend does not support input requests."
    856             )
    857         return self._input_request(str(prompt),

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

What could be causing this mis match?

wjandrea
  • 28,235
  • 9
  • 60
  • 81
Sumit
  • 99
  • 6
  • I edited the question to clarify what you're asking exactly. If I've misunderstood, by all means [edit] to fix it. And LMK if you do so I can update my answer. I assume you've read and understood the error message but you're confused about the details. – wjandrea Dec 16 '21 at 20:18

1 Answers1

0

IPython refers to input as raw_input for historical reasons.

Python 2's raw_input was renamed input in Python 3. For more info, see What's the difference between `raw_input()` and `input()` in Python 3?

IPython used to support Python 2 and 3, so it had code like this:

if PY3:
    ...
    builtin_mod.input = self.raw_input
else:
    ...
    builtin_mod.raw_input = self.raw_input

then they dropped Python 2 support in version 6.0 so it became:

...
builtin_mod.input = self.raw_input

Here's the diff on GitHub

wjandrea
  • 28,235
  • 9
  • 60
  • 81