Forums

Can't download a Jupyter Notebook

When I click on the button to download a file that is a Jupyter Notebook, instead of the file downloading a new browser tab opens with the JSON content of the file. I tried this in both Chrome and Firefox. ScreenCapture

Anyone else experienced this problem?

Try right click and save link as?

When I tried that I got html. Did it work for you?

hmm yeah. is there a way to save as a different file format? (instead of as html)

Sorry about the UI snafu! We will look into fixing it. As a temporary alternative, you could also either use git or scp etc to download the file. See here for options.

I have a paid account, so sftp worked. For those that don't, you can click on the download link and copy the contents from the window that appears into a text editor and save with the notebook extension. Not elegant, but it worked!

This is a problem for me, too. In my case, I have a script that produces an output tabular text file for use in Excel. The download button opens a window with the data, which I have to copy/paste into a text file, then open in Excel. I have a lot of these files to generate and download, so the copy/paste step is somewhat inconvenient.

Could you download them from a script using scp / sftp?

Thanks, harry. It would be ideal to be able to download files to my personal machine automatically from within the script. I tried without success running scp/sftp from a bash window to download an output file (could not resolve hostname, etc), but that is certainly due to my incompetence. I have minimal experience with network operations. I'll google around on how to use scp/sftp in python.

were you trying to download by running the script from your own computer? or from pythonanywhere? and do you know how to scp files manually from the command line?

I and colleagues at my company are running the script from pythonanywhere. I wanted a simple way to post a Python script for my colleagues who don't have Python to do an analysis by uploading a data file, running the script on pythonanywhere, generating output files on pythonanywhere, and downloading the output files to their personal computers. It all works except the download part.

I'm studying scp/sftp docs but am a newbie in this area and so far not able to get it to work from the command line. Plus, I don't want my colleagues to have to mess with the command line, which is a pain in the best of circumstances. So ideally my pythonanywhere script would download the files automatically to the local machine without requiring any local configuration, but that's probably too much to hope for. So I would be happy just to be able to click the download button and have the file download.

We need our downloads to be useful for all sorts of general files and uses, and showing text files in the browser is one of the ways we accomplish this.

Is there some reason your users can't use the right-click->Save as... option in the browser?

Also, depending on the time it takes to run the script (if it's more than a few seconds then this is probably not a good idea), you could turn it into a web app that runs the analysis code and provides the download. Then your users wouldn't even need to log into your PythonAnywhere account - they could just have their own individual logins to the web app.

Thanks, Glenn. When I right-click on the file, I see no Save As, just Save Link As, which doesn't seem to help. I'm on Chrome. The web app idea is good. I just haven't done one before and hoped that wasn't necessary. And in truth it isn't, as copy/pasting the file display works, sort of.

My expectation of downloading a file came from Wakari (since deceased), where clicking on "Download" meant a file would end up on my local machine.

Mark

I think if you click "save link as", it will download the ipython notebook file.

So you won't be able to write a script that downloads to your local machine unless your local machine is available for access over the internet.

You could for example write a script that grabs a bunch of files/prompts for what files you want to send, and then prompts for an email and send it to that email. (if you are frequently sending multiple notebooks to colleagues)

Thanks for the suggestion, bfg. We'll go the copy/paste route for now, I think.

For what it's worth, the "save link as" option has not been working for me (it forces a .html format for download), but I think that is related to my Chrome browser. Safari has no problem.

Mark