GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
%save fails in the nb/qtconsole if a file already exists, because it tries to ask the user interactively and this produces a StdinNotImplementedError. We should in that case capture the exception, print instead a message and offer a -f option to support forced writes.
In some other case that tried to prompt the user, we went with printing a warning and overwriting the file, but I forget what that was.
For something as serious as overwriting a whole .py file, I somehow
feel more comfortable requiring an explicit -f switch... What do you
That makes sense, I just thought I'd note the contrast. Should we change %hist -f to behave the same way? We'd need to call the 'force' option something other than f if so, as that means file there. y for yes would be an obvious choice.
Also, we should get %save to use the ask_yes_no function - that's why we didn't spot it when we were doing the others.
for reference, the previous similar case Thomas mentions is %reset as it was described in #1268 and implemented in #1288
And at some point we've done the same for %hist -f, which is more similar to %save.
Merge pull request #1937 from minrk/save
Add -f (force) flag to %save, and display message about -f when ask_yes_no fails due to no stdin (Notebook).
add %save -f
adds force flag, and displays message about -f when ask_yes_no fails
due to no stdin (Notebook).