gatech-csl / jes

The Jython Environment for Students allows students to write Jython programs that can manipulate pictures, sounds, and videos.
http://mediacomputation.org/
60 stars 38 forks source link

print statement doesn't work #44

Open leafstorm opened 10 years ago

leafstorm commented 10 years ago

From tompwha...@gmail.com on July 11, 2010 10:17:09

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: http://code.google.com/p/mediacomp-jes/issues/detail?id=44

leafstorm commented 10 years ago

From ajud...@gmail.com on December 14, 2010 10:45:03

I'm seeing this problem too on JES 4.3 on Mac, OS X 10.5.8

leafstorm commented 10 years ago

From ajud...@gmail.com on December 14, 2010 11:42:44

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!"

leafstorm commented 10 years ago

From tompwha...@gmail.com on December 14, 2010 18:59:11

Andy,

There is a printNow function that you might check out.

Tom

leafstorm commented 10 years ago

From Gin...@gmail.com on May 19, 2011 00:13:50

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

leafstorm commented 10 years ago

From Gin...@gmail.com on July 18, 2011 22:40:36

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

benevolentprof commented 9 years ago

I'm using JES 4.3 on OS X 10.9.5. I find that print doesn't work in a function or outside of one. (And yes, printNow does work.)

mjguzdial commented 9 years ago

Interesting! I've not heard of this bug before. I just tested in OS X 10.10.2, and print is working for me. Could you send some source code that fails?

[cid:94E94AE1-CA88-4630-94D3-29BDB6DCDE8F] On Mar 11, 2015, at 11:22 PM, Susan Elliott Sim notifications@github.com<mailto:notifications@github.com> wrote:

I'm using JES 4.3 on OS X 10.9.5. I find that print doesn't work in a function or outside of one. (And yes, printNow does work.)

— Reply to this email directly or view it on GitHubhttps://github.com/gatech-csl/jes/issues/44#issuecomment-78417320.

benevolentprof commented 9 years ago

Here some code that fails:

def print_something(): print "More text"

print "Some text" print_something()

To be clear, this is a problem in the Program Area, but not in the Command Area.

On Sat, Mar 14, 2015 at 10:36 AM, mjguzdial notifications@github.com wrote:

Interesting! I've not heard of this bug before. I just tested in OS X 10.10.2, and print is working for me. Could you send some source code that fails?

  • Mark

[cid:94E94AE1-CA88-4630-94D3-29BDB6DCDE8F] On Mar 11, 2015, at 11:22 PM, Susan Elliott Sim <notifications@github.com mailto:notifications@github.com> wrote:

I'm using JES 4.3 on OS X 10.9.5. I find that print doesn't work in a function or outside of one. (And yes, printNow does work.)

— Reply to this email directly or view it on GitHub< https://github.com/gatech-csl/jes/issues/44#issuecomment-78417320>.

— Reply to this email directly or view it on GitHub https://github.com/gatech-csl/jes/issues/44#issuecomment-80511162.

mjguzdial commented 9 years ago

Is this actually

def print_something(): print "More text"

print "Some text" print_something()

Otherwise, Python will complain about the function print_something() doesn't have a body.

Yes, that fails for me in JES 4.3, too. But it works fine in JES 5

[cid:046CC361-D812-40E2-949E-B760A382FD2A]

On Mar 14, 2015, at 11:34 AM, Susan Elliott Sim notifications@github.com<mailto:notifications@github.com> wrote:

Here some code that fails:

def print_something(): print "More text"

print "Some text" print_something()

To be clear, this is a problem in the Program Area, but not in the Command Area.

http://www.drsusansim.org Twitter: @benevolentprof Skype: benevolentprof Cell: 647 970 9425

On Sat, Mar 14, 2015 at 10:36 AM, mjguzdial notifications@github.com<mailto:notifications@github.com> wrote:

Interesting! I've not heard of this bug before. I just tested in OS X 10.10.2, and print is working for me. Could you send some source code that fails?

  • Mark

[cid:94E94AE1-CA88-4630-94D3-29BDB6DCDE8F] On Mar 11, 2015, at 11:22 PM, Susan Elliott Sim notifications@github.com<mailto:notifications@github.com mailto:notifications@github.com> wrote:

I'm using JES 4.3 on OS X 10.9.5. I find that print doesn't work in a function or outside of one. (And yes, printNow does work.)

— Reply to this email directly or view it on GitHub< https://github.com/gatech-csl/jes/issues/44#issuecomment-78417320>.

— Reply to this email directly or view it on GitHub https://github.com/gatech-csl/jes/issues/44#issuecomment-80511162.

— Reply to this email directly or view it on GitHubhttps://github.com/gatech-csl/jes/issues/44#issuecomment-80535703.

benevolentprof commented 9 years ago

Yes, I use only two spaces in my indents.