Closed thisisapple closed 1 month ago
I got a simple workaround for this issue. Open terminal and enter this command:
jupyter nbconvert --to html --no-input your_notebook.ipynb
You should get a html file with the same name.
There is another solution. You can write a custom function. Save the function in the same folder and import the py file into your notebook. At the end of the notebook, you can call the function to export the notebook. Below is an example.
import subprocess
import os
def export_notebook(input_path, output_path, format='html'):
if format not in ['html', 'pdf']:
raise ValueError("Format must be either 'html' or 'pdf'")
to_format = f'--to {format}'
no_input_flag = '--no-input'
command = f'jupyter nbconvert {to_format} {no_input_flag} --output {os.path.splitext(output_path)[0]} {input_path}'
try:
subprocess.run(command, shell=True, check=True)
print(f"Notebook successfully exported to {output_path}")
except subprocess.CalledProcessError as e:
print(f"An error occurred while exporting the notebook: {e}")
print(e.output)
Hello, Connor Thanks for your incredible work. I like your product. I am reporting an issue here. I installed Python 3.9, jupyter v1.0.0, handcalcs v1.9 and nbconvert v7.16. But I do not have the options to hide the input. See the attached screenshot.