SGladys / mediacomp-jes

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

print statement doesn't work #44

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.If I load a simple "hello, world" program (print "Hello, world!" nothing is 
printed in the interaction pane.
2.If I have variables, I can tell that the program has executed, but nothing 
prints.
3.

What is the expected output? What do you see instead? "Hello, world!"

What version of the product are you using? On what operating system?
4.3 on Windows NT

Please provide any additional information below.

Original issue reported on code.google.com by tompwha...@gmail.com on 11 Jul 2010 at 2:17

GoogleCodeExporter commented 8 years ago
I'm seeing this problem too on JES 4.3 on Mac, OS X 10.5.8

Original comment by ajud...@gmail.com on 14 Dec 2010 at 6:45

GoogleCodeExporter commented 8 years ago
Investigated some more, this time on XP
I have a simple guessing game program (below) that uses print() and raw_input()
I don't see the output from any of the print() calls until the program exits
The prompt from the raw_input() appears, however

Thanks,
Andy
------------------------------------

import random

def play():
  numToGuess = random.randint(1,20)
  while True:
    guess = int(raw_input("Guess?"))
    if guess == numToGuess:
      print "Yes!!!"
      break
    elif guess > numToGuess:
      print "Too high"
    else:
      print "Too low"
  return

def main():
  while True:
    play()
    resp = raw_input("Play again?")
    if resp == "no" or resp == "No":
      break
  print "Adios!"

Original comment by ajud...@gmail.com on 14 Dec 2010 at 7:42

GoogleCodeExporter commented 8 years ago
Andy,

There is a printNow function that you might check out.

Tom

Original comment by tompwha...@gmail.com on 15 Dec 2010 at 2:59

GoogleCodeExporter commented 8 years ago
I'd second this request. I'm thinking of using JES for teaching but the lack of 
print and input/raw_input statements would mean that sample programs from 
elsewhere wouldn't work. Not realising this, I tried a baby version of Eliza, 
and when pasted into JES and run, it appeared to just hang. In reality, it was 
waiting for input, but it wasn't obvious as nothing was shown to the user.

Given that there's so much tutorial Python info about, and beginners are likely 
to try and run code they find elsewhere, the inability to run standard python 
is likely to be confusing.

Any hope of making the standard I/O calls work in the console window?

Thanks - Gino

Original comment by Gin...@gmail.com on 19 May 2011 at 7:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I've just discovered (using Jes 4.3 on Windows 7), that the print statement 
does work when it's inside a function, but not if it's at the top level (i.e. 
so it's  executed when a program is Loaded):
================================
def fn():
  x = input ("how many times: ")
  print "this works " * x

print "this doesn't"
================================

Calling fn() from the console displays the input prompt and then the output 
from the print but the print outside doesn't display anything.

Cheers Giovanni

Original comment by Gin...@gmail.com on 19 Jul 2011 at 5:40