Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Eclipse Carriage Return Workaround

Reply
Thread Tools

Re: Eclipse Carriage Return Workaround

 
 
Fabio Zadrozny
Guest
Posts: n/a
 
      12-19-2009
On Sat, Dec 19, 2009 at 8:36 AM, Fabio Zadrozny <(E-Mail Removed)> wrote:
> On Fri, Dec 18, 2009 at 1:38 PM, Steve Holden <(E-Mail Removed)> 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/...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.
>


I just noted that you said they are already using pydev -- maybe it's
an old version? Or maybe you're doing a custom launcher that overrides
the usual pythonpath and for some reason is not passing the
pydev_sitecustomize folder?

Cheers,

Fabio
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Eclipse Carriage Return Workaround Fabio Zadrozny Python 0 12-19-2009 10:36 AM
Eclipse Carriage Return Workaround Steve Holden Python 1 12-19-2009 12:26 AM
Carriage Return added during return of large string from class method Xeno Campanoli Ruby 0 02-13-2006 08:39 PM
Help: Delete a single carriage return in a file, but not a double carriage return? Steve Anderson Perl Misc 3 06-21-2004 12:48 AM
Postback after carriage return input Ferdi ASP .Net 5 08-24-2003 07:12 AM



Advertisments