Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fomightez/49203b0012724734e9f7 to your computer and use it in GitHub Desktop.
Save fomightez/49203b0012724734e9f7 to your computer and use it in GitHub Desktop.
Using SimpleHTTPServer on Mac to run JSmol locally

##Using SimpleHTTPServer to run JSmol locally with Chrome

adapted from Nelson Liu's post to Jmol Users' list Tue, 17 Feb 2015. It will work out of the box on both Mac and Linux machines. Windows will need Python installed and a terminal emulator (UNTESTED!!). Doesn't matter if you are already running Chrome; I didn't have luck with open -a /Applications/Google\ Chrome.app/ --args --allow-file-access-from-files when I already had Chrome running.

  • Skip the first three steps if you already downloaded Jmol, unpacked it, and unpacked jsmol.zip.

  • Download Jmol binary.

  • Unpack binary.

  • Unpack jsmol.zip within the unpacked Jmol folder.

  • In the Terminal program, navigate into the unpacked jsmol folder. It will be something like

      cd /Users/Me/Downloads/jmol-14.2.12/jsmol
    

    (Note on a Mac you can drag folder icon from within the Finder program gui to after cd in Terminal.)

  • Issue command below to start the server

      python -m SimpleHTTPServer
    
  • You'll see something like Serving HTTP on 0.0.0.0 port 8000 .... You need that port number. Default is generally 8000.

  • In your Chrome browser, enter a URL similar to below using the port number you observed in Terminal after the colon.

      http://localhost:8000
    
  • Select a page, such as test2.htm, and open it. JSmol should run in Chrome without issuing a NetworkError.

  • Back in the Terminal window you'll see reports as you communicate with the server from the browser.

  • Type ctrl-c (Control key held down while pressing c key) in terminal to exit running server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment