SGladys / mediacomp-jes

Automatically exported from code.google.com/p/mediacomp-jes
0 stars 0 forks source link

Can't flush stdout before asking for user input #47

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

import sys
def test():
  print "I am testing"
  sys.stdout.flush()
  value = input("enter integer")
  print value

What is the expected output? What do you see instead?

Expected:  
  I am testing 
  enter integer 
....

Instead:
  The print statement is not flushed to the screen.

What version of the product are you using? On what operating system?
  JES 4.3

Please provide any additional information below.

Original issue reported on code.google.com by wendy.powley@gmail.com on 21 Sep 2010 at 10:03

GoogleCodeExporter commented 8 years ago
Sorry, I forgot to say that I'm working on Windows 7

Original comment by wendy.powley@gmail.com on 22 Sep 2010 at 12:23

GoogleCodeExporter commented 8 years ago
Never mind ... I figured it out. 

Original comment by wendy.powley@gmail.com on 22 Sep 2010 at 11:38

GoogleCodeExporter commented 8 years ago
Has this been fixed?

Original comment by pammeier...@gmail.com on 25 Aug 2013 at 11:54

GoogleCodeExporter commented 8 years ago
input() will not work correctly in JES, because of an interaction between Swing 
and the Jython interpreter.  sys.stdout.flush() is unlikely to work (or rather, 
it will work, but the Console won't update until the execution ends).  That's 
why we created requestString() instead.  These issues are discussed in the book.

Original comment by guzd...@gmail.com on 26 Aug 2013 at 12:45

GoogleCodeExporter commented 8 years ago
Thank you very much.  I'm new to the book and teaching the class, so I'm
learning as I'm going.

Original comment by pammeier...@gmail.com on 26 Aug 2013 at 6:11