Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Strange behaviour of input() function (Python 3.2)

Reply
Thread Tools

Strange behaviour of input() function (Python 3.2)

 
 
sunrrrise
Guest
Posts: n/a
 
      05-22-2011
Hello,
this is my first post. I'm trying to learn Python language which I find great, but I have a big problem with its editors/IDEs.

I have tested IDLE (which installed with Python3 from ActiveState), Notepad++ and finally Komodo EDIT. I don't like IDLE GUI, but Notepad++ and Komodo EDIT looks nice for me.

Unfortunatelly there is something wrong with input() command when I'm using Komodo or Notepad. For example this code:

a = input("Wprowadz zmienna a: ")
b = input("Wprowadz zmienna b: ")
print("a to: ", a)
print("b to: ", b)
print(int(a) + int(b))

works well in IDLE, but when I'm switching to Notepad/Komodo I'm getting something like this:

Wprowadz zmienna a: 3
Wprowadz zmienna b: 2
a to: 3
b to: Wprowadz zmienna b: 2
Traceback (most recent call last):
File "c:\users\sunrrrise\Desktop\test.py", line 9, in <module>
print(int(a) + int(b))
ValueError: invalid literal for int() with base 10: 'Wprowadz zmienna b: 2'

I don't know what is going on. Any ideas or, better, solutions?

My OS: Windows 7 64bit, ActiveState Python 3.2, Notepad++ 5.9, Komodo Edit 6.1, coding: UTF-8

Regards,
sunrrrise
 
Reply With Quote
 
 
 
 
Chris Angelico
Guest
Posts: n/a
 
      05-22-2011
On Mon, May 23, 2011 at 8:43 AM, sunrrrise <> wrote:
> Hello,
> this is my first post. I'm trying to learn Python language which I find great, but I have a big problem with its editors/IDEs.


Welcome!

> b to: *Wprowadz zmienna b: 2


This looks wrong. Are you copying and pasting several lines, or simply
pressing the 2 key followed by Enter?

It's showing a lengthy string in the variable 'b', which - quite
correctly - cannot be cast to int.

Chris Angelico
 
Reply With Quote
 
 
 
 
Chris Angelico
Guest
Posts: n/a
 
      05-22-2011
On Mon, May 23, 2011 at 8:59 AM, sunrrrise <> wrote:
> Thank you for quick response!
>
> English is not my native language so I'm going to keep my explanations simple.


No problem, your English is far better than my Polish. (I used Google
Translate to figure out what "Wprowadz zmienna" means.)

I tried copying and pasting your exact code, even down to using
Notepad, but it worked fine. The interpreter I used was a
freshly-downloaded Python 3.2, listing itself as r32:88445 dated Feb
20 2011, 21:29:03.

This may be a really specific bug. Can you email me the actual Python
file you're having problems with, please? Off-list, as this list
doesn't like attachments. I'll try running it on my system and see if
it's any different.

Chris Angelico
 
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
strange behaviour w.r.t get function Rahul!! Perl Misc 2 03-30-2011 05:00 PM
Strange behaviour in function overloading! Paulo da Silva C++ 8 07-03-2007 02:44 PM
debugger behaviour different to execution behaviour Andy Chambers Java 1 05-14-2007 09:51 AM
Strange Behaviour of this function g.ankush1@gmail.com C Programming 23 11-20-2006 07:47 AM
strange function behaviour muser C++ 9 10-14-2003 09:50 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57