Commit 34cc4d08 authored by Eric Pellegrini's avatar Eric Pellegrini
Browse files

added a script for running hdfviewer from command-line

updated file accordingly
parent 20fb1b32
#!/usr/bin/env python3
import nbformat
import os
import subprocess
import sys
import tempfile
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Invalid number of arguments")
filename = sys.argv[1]
if not os.path.isfile(filename):
print("The file {!r} does not exist".format(filename))
cells = []
cells.append("%matplotlib ipympl")
cells.append("""from hdfviewer.widgets.HDFViewer import HDFViewerWidget""")
cells.append("""widget = HDFViewerWidget({!r})
notebook = nbformat.v4.new_notebook(metadata={'language': 'python',})
notebook["cells"] = [nbformat.v4.new_code_cell(cell) for cell in cells]
notebookFilename = tempfile.mktemp(suffix=".ipynb")
with open(notebookFilename,"w") as f:
nbformat.write(notebook, f, 4)
......@@ -48,4 +48,5 @@ setup(name = name,
install_requires = ["numpy","matplotlib","h5py","jupyterlab","ipywidgets","ipympl"],
cmdclass = cmdclass,
command_options = command_options,
scripts = ["scripts/run_hdfviewer"]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment