Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quit Does Not Quit When Requested #310

Open
mandli opened this issue Oct 21, 2024 · 4 comments
Open

Quit Does Not Quit When Requested #310

mandli opened this issue Oct 21, 2024 · 4 comments
Assignees

Comments

@mandli
Copy link
Member

mandli commented Oct 21, 2024

I noticed that the new functionality added by #308 has a peculiar behavior when q is pressed. I think it thinks it quits but another q into the terminal is necessary. Not entirely sure why this is happening but maybe @giboul might?

Also, the 80's pop song issue title was purposeful.

@giboul
Copy link
Contributor

giboul commented Oct 22, 2024

Hi Kyle!

My best guess is that the process is stuck in the readlineinput inside the cmdloop because the key bindings are bypassing cmd by directly calling cmd.do_<key>: https://github.com/python/cpython/blob/3.13/Lib/cmd.py#L134

Maybe I should've passed the keys directly to stdout so that #308 integrates into cmd... I just don't know how to send 'enter' to stdout the console (or just force the readlineinput() to execute), let me read up on it.

Edit: I think an EOFError should be raised but my attempts raised the error to matplotlib instead of cmd

@mandli
Copy link
Member Author

mandli commented Oct 22, 2024

Yeah, that's what I was guessing but I am not sure either what to send the key press to. It's not too big of a deal as you can easily quit by returning to the terminal. It is odd that it seems to think it quit though given it responds accordingly.

@rjleveque
Copy link
Member

@mandli, @giboul -- I'm trying to replicate this, but not seeing any strange behavior when using Iplotclaw as below....

In [4]: ip=Iplotclaw(outdir='_output'); ip.plotloop()
Importing setplot.setplot from /Users/rjl/git/clawpack/geoclaw/examples/tsunami/chile2010.
Executed setplot successfully

Interactive plotting... 
Type ? at IPLOT prompt for list of commands

    Start at which frame [default=0] ? 1
    Reading  Frame 1 at t = 3600  from outdir = /Users/rjl/git/clawpack/geoclaw/examples/tsunami/chile2010/_output
    Plotting Frame 1 at t = 3600.0
PLOTCLAW > n
    Reading  Frame 2 at t = 7200  from outdir = /Users/rjl/git/clawpack/geoclaw/examples/tsunami/chile2010/_output
    Plotting Frame 2 at t = 7200.0
PLOTCLAW > q
quitting...

In [5]: 

And also when I use pyclaw, e.g.

$ cd $CLAW/pyclaw/examples/euler_2d
$ python shock_bubble_interaction.py iplot=1
...
PLOTCLAW > 
    Reading  Frame 4 at t = 0.24  from outdir = /Users/rjl/Downloads/clawpack-v5.10.0pyclaw/pyclaw/examples/euler_2d/_output
    Plotting Frame 4 at t = 0.24
PLOTCLAW > q
quitting...
$ 

Is there something different I should try?

@mandli
Copy link
Member Author

mandli commented Oct 26, 2024

Is the plot window in the forefront? If the terminal receives the q input it behaves normally. I see the following when the plot window receives the q.

Interactive plotting...
Type ? at IPLOT prompt for list of commands

    Start at which frame [default=0] ?
    Reading  Frame 0 at t = 0  from outdir = /Users/kmandli/Documents/src/clawpack/geoclaw/examples/tsunami/chile2010/_output
    Plotting Frame 0 at t = 0.0
PLOTCLAW >
    Reading  Frame 1 at t = 1800  from outdir = /Users/kmandli/Documents/src/clawpack/geoclaw/examples/tsunami/chile2010/_output
    Plotting Frame 1 at t = 1800.0
PLOTCLAW >
    Reading  Frame 2 at t = 3600  from outdir = /Users/kmandli/Documents/src/clawpack/geoclaw/examples/tsunami/chile2010/_output
    Plotting Frame 2 at t = 3600.0
PLOTCLAW >
quitting...
PLOTCLAW > q
quitting...

The second q is sent to the terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants