Limiting Python raw_input () using Mac OS X terminal?

I wrote a python script and ran it in a terminal on a Mac OS X snow leopard using python2.6. I used raw_input () to import the text in several places, but it seems that I have reached the limit where it will no longer accept any characters.

Is this the limit in python raw_input () or is it something related to terminal or Mac OSX?

Is there a better way to get the user to type more text in python?

+4
source share
2 answers

I would say that this is a limitation / error with OSX Terminal - try running a script with login via IDLE and see if you are still facing the same problem.

As for the best ways to work with a large input - it completely depends on your requirements, but some methods may be:

  • Import text from file
  • Create some kind of GUI / interface for handling text input with more user-friendly controls.
+3
source

I had the same experience and I found that python limits the input length to raw_input if you do not import the readline module. After I imported the readline module, it raised the limit (or at least significantly increased it so that the text I used worked fine).

0
source

All Articles