Re: Eclipse Carriage Return Workaround

Discussion in 'Python' started by Fabio Zadrozny, Dec 19, 2009.

  1. On Fri, Dec 18, 2009 at 1:38 PM, Steve Holden <> wrote:
    > I've written a Python 3 course that uses an Eclipse-based teaching
    > system. The school is telling me that their version of Eclipse/pydev
    > appears to have an input() function that appends a carriage return
    > character to the user's input. This makes several things go screwy, as
    > it's definitely not the way the standalone interpreter works, even on
    > Windows.
    >
    > Can anyone think of a simple way work around this issue by overriding
    > __builtins__.input() with a function that calls input() and then returns
    > an rstrip()ped version of the input string? I though of setting a
    > PYTHONSTARTUP environment variable, but that only affects interactive
    > interpreter instances.


    In my opinion that's a python bug (because it should be able to remove
    the \r\n and not only \n).

    Anyway, Pydev also had that problem and it was fixed by having a
    custom sitecustomize.py:

    See: http://github.com/aptana/Pydev/tree/master/plugins/org.python.pydev/PySrc/pydev_sitecustomize/

    It just has to added to the pythonpath before the run (and it'll
    remove itself and call the default later on) -- the only catch is that
    it has to be on a folder called "pydev_sitecustomize" -- you can
    probably change the code if you don't want to follow that.

    It'll fix input(), raw_input() and will also fix encoding problems
    when writing non ASCII to the console (you may set a
    'PYDEV_CONSOLE_ENCODING' in the environment or let it try to find a
    default on) -- should be compatible with python 2 or 3.

    Cheers,

    Fabio
    Fabio Zadrozny, Dec 19, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ferdi
    Replies:
    5
    Views:
    4,667
    Jacob Yang [MSFT]
    Aug 24, 2003
  2. Steve Holden

    Eclipse Carriage Return Workaround

    Steve Holden, Dec 18, 2009, in forum: Python
    Replies:
    1
    Views:
    335
    Gregory Ewing
    Dec 19, 2009
  3. Fabio Zadrozny

    Re: Eclipse Carriage Return Workaround

    Fabio Zadrozny, Dec 19, 2009, in forum: Python
    Replies:
    0
    Views:
    1,626
    Fabio Zadrozny
    Dec 19, 2009
  4. Xeno Campanoli
    Replies:
    0
    Views:
    217
    Xeno Campanoli
    Feb 13, 2006
  5. Steve Anderson
    Replies:
    3
    Views:
    239
    Steve Anderson
    Jun 21, 2004
Loading...

Share This Page