Strange behaviour of input() function (Python 3.2)

S

sunrrrise

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
 
C

Chris Angelico

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
 
C

Chris Angelico

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top