473,385 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Strange behavior of the Eclipse embedded console

i've faced with some strangeness while executing this sample:

choice = raw_input("your choice: ")
print len(choice)

when i run this sample in my eclipse console with CPython and print
Yes, i have this output
4 #trailing \t is the fourth element

but when i use command line method
python sample.py
i have the correct length = 3

i'm curious now, can anyone explain that?

Mar 20 '08 #1
2 1791
On 20 อมา, 14:31, hellt <Dodin.Ro...@gmail.comwrote:
i've faced with some strangeness while executing this sample:

choice = raw_input("your choice: ")
print len(choice)

when i run this sample in my eclipse console with CPython and print
Yes, i have this output
4 #trailing \t is the fourth element

but when i use command line method
python sample.py
i have the correct length = 3

i'm curious now, can anyone explain that?

just took a look into PyDEV-FAQ.

"The eclipse console is not an exact copy of a shell... one of the
changes is that when you press <ENTERin a shell, it may give you a
\r, \n or \r\n as an end-line char, depending on your platform. Python
does not expect this -- from the docs it says that it will remove the
last \n (checked in version 2.4), but, in some platforms that will
leave a \r there. This means that the raw_input() should usually be
used as raw_input().replace('\r', ''), and input() should be changed
for: eval(raw_input().replace('\r', ''))."

Mar 20 '08 #2
On Mar 20, 9:09*am, hellt <Dodin.Ro...@gmail.comwrote:
"The eclipse console is not an exact copy of a shell... one of the
changes is that when you press <ENTERin a shell, it may give you a
\r, \n or \r\n as an end-line char, depending on your platform. Python
does not expect this -- from the docs it says that it will remove the
last \n (checked in version 2.4), but, in some platforms that will
leave a \r there. This means that the raw_input() should usually be
used as raw_input().replace('\r', ''), and input() should be changed
for: eval(raw_input().replace('\r', ''))."
While I do love Eclipse as a Python code editor, interactive debugger,
front-end to SVN / Trac, and for many other things... it is
unfortunately terrible as an interactive console.

But then again, despite being a long time Emacs user I never did
anything complex inside Emacs' shell / terminal emulator, instead
preferring a 'real' console using xterm or rxvt or konsole or what
have you.

By the way, so far the only text editing feature from Emacs I am
missing in Eclipse is the ability to reformat line endings - i.e., M-x
fill-paragraph-or-region

regards
Preston
Mar 20 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Grzegorz | last post by:
Hello, I'm using eclipse with pydev plugin, I'm working on a program using wxpython . When I'm executing that application standard error output does not show in eclipse console window - wxpython...
4
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my...
5
by: Terry | last post by:
It's my understanding of UDP sockets that if there is a thread blocked on a "recvFrom()" call and other thread sends a UDP packet to some address, that if the machine on the other end isn't up,...
1
by: hansolox1 | last post by:
The following program simply sets the icon of a form called form1. When I get the name of the embedded icon using GetManifestResourceNames(), I store the name in a string variable called s. The...
14
by: Camellia | last post by:
Hi all, Can anyone please tell me how to pass an EOF signal in Eclipse? I've googled it and searched the CDT manual but still couldn't find it. I've tried ctrl+c and ctrl+d, they don't work. Any...
16
by: Amir Michail | last post by:
Hi, It seems to me that measuring productivity in a programming language must take into account available tools and libraries. Eclipse for example provides such an amazing IDE for java that it...
8
by: FBM | last post by:
Hi there, I am puzzled with the behavior of my code.. I am working on a networking stuff, and debugging with eclipse (GNU gdb 6.6-debian).. The problem I am experiencing is the following: ...
0
by: why | last post by:
I have a problem with embedded content, quicktime and youtube flash content, in a page. My page has a sidebar on the left and mixed content on the right. When I scroll through the content and the...
4
by: Gabriel Rossetti | last post by:
Hello, I wrote a program that reads data from a file and puts it in a string, the problem is that it loops infinitely and that's not wanted, here is the code : d =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.