Issue391

Title try-except handling
Priority bug Status resolved
Superseder Nosy List agha, kayhayen
Assigned To kayhayen Keywords

Created on 2018-01-06.15:52:45 by agha, last changed by kayhayen.

Messages
msg2310 (view) Author: kayhayen Date: 2018-03-13.18:43:10
My bet is that your Nuitka is using Python2 on your code, where 2.3 is valid 
input, for me it does this:

# python3 Mini.py 
enter integer number: 2.3
this was no integer, try again ...
enter integer number: e
this was no integer, try again ...
enter integer number: 3
done
# python3 bin/nuitka-run Mini.py 
enter integer number: 2.3
this was no integer, try again ...
enter integer number: e
this was no integer, try again ...
enter integer number: 3
done

Therefore marking as resolved.
msg2300 (view) Author: agha Date: 2018-01-08.06:25:01
Thanks for checking.

Run in Idle interpreter the code generates following output:

enter integer number: 2.3
	this was no integer, try again ...
	enter integer number: e
	this was no integer, try again ...
	enter integer number: 2
	done
	>>>

run the compiled executable generates:
	enter integer number: 2.3
	done
but it should loop to the input prompt until an integer was entered and only then output "done" like the first output.

This is just my first trial with your compiler and the output of compiling command:
./nuitka /path/filename.py

Thanks
Alexander
msg2299 (view) Author: kayhayen Date: 2018-01-06.17:38:49
I cannot reproduce this at all. What Python version is this, what invalid value 
do you enter, maybe the issue is in "int" not catching some things.

Yours,
Kay
msg2298 (view) Author: agha Date: 2018-01-06.15:52:44
Code:
while True:
    try:
        n = input("enter integer number: ")
        n = int(n)
        break
    except ValueError:
        print("this was no integer, try again ...")
print("done")

Problem:
goes staight to "done" instead of looping back after entering a non integer numbe
number
number

compiled on Debian Linux w/ package pythonNuitka-0.5.28.2.tar.gz
History
Date User Action Args
2018-03-13 18:43:10kayhayensetstatus: chatting -> resolved
messages: + msg2310
2018-01-08 06:25:01aghasetmessages: + msg2300
2018-01-06 17:38:49kayhayensetstatus: unread -> chatting
assignedto: kayhayen
messages: + msg2299
nosy: + kayhayen
2018-01-06 15:52:45aghacreate