STDIN in Komodo IDE 10 - Debug in separate console (Python3)

Hello,

I have problem running this python file in Komodo IDE (version 10.2.3, build 89902):


(import this file: http://introcs.cs.princeton.edu/python/code/stdio.py.html)

When I not check “Debug in separate console” in Project Preferences
and run this file in “Debug Output” I can type:
200 100
Ctrl-D
and output will be:
‘Average is 150.0’

But when I check “Debug in separate console” in Project Preferences
and run this file in separate console I got an error:


File “C:\komodo\average.py”, line 5, in
import stdio
File “C:\komodo\stdio.py”, line 31, in
sys.stdin = open(sys.stdin.fileno(), ‘r’, newline=None)
io.UnsupportedOperation: fileno

This error I can get in my Macbook too.

Is it a bug in Komodo IDE?
Thanks!

Hi, I do not think this is a bug in Komodo IDE. I think this is an issue with Python running in the Windows console. STDIN can be weird in Windows.

He’s able to reproduce the issue on OSX as well. It makes me thinking that the problem is in the code though.

@Andrewd, are you able to reproduce the issue by running the script using python3.exe average.py?

In Python 2.7 (Language: “Python” in Komodo’s Project Preferences) it’s OK - I can see console without errors after running this script.

Running the script using python3.exe average.py - it’s OK in windows console (no error).

I guess Komodo changes the sys.stdin object when you’re using “Debug in separate console” so this is why your code does not work. IDLE has the same problem:

It does indeed change your STDIN for debugging purposes, nice digging @Defman. I don’t think this is something we can easily fix on our end. Is there a reason you can’t debug the code from within Komodo?

I’m just learning Python from Sedgwick’s book. I can debug the code from within Komodo, but for graphic output I need separate console. THE BEST PYTHON IDE will be much better with such functionality. Аgain, it works in Windows for Python 2.7 (Language: “Python” in Project Preferences ). I get 3 different results on Mac for such configuration:

  1. first run - error:

  2. second run - another error:

  3. third run - at last!