Skip to content

Commit 4a53676

Browse files
committed
fix missing libraries and imports
1 parent 8f56e1d commit 4a53676

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/notebooks/callbacks.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"outputs": [],
1717
"source": [
1818
"# uncomment and run if you're on Google Colab\n",
19-
"# !pip install rdkit-pypi mols2grid\n",
19+
"# !pip install rdkit-pypi mols2grid py3Dmol\n",
2020
"# !wget https://raw.githubusercontent.com/rdkit/rdkit/master/Docs/Book/data/solubility.test.sdf"
2121
]
2222
},
@@ -30,7 +30,8 @@
3030
"from pathlib import Path\n",
3131
"from rdkit import RDConfig\n",
3232
"from ipywidgets import widgets\n",
33-
"import urllib\n",
33+
"import urllib.request, urllib.parse\n",
34+
"from urllib.error import HTTPError\n",
3435
"from IPython.display import display\n",
3536
"import py3Dmol\n",
3637
"SDF_FILE = (f\"{RDConfig.RDDocsDir}/Book/data/solubility.test.sdf\"\n",
@@ -71,6 +72,7 @@
7172
"# its presence is mandatory if you want to print/display some info with your callback\n",
7273
"@output.capture(clear_output=True, wait=True)\n",
7374
"def show_data(data):\n",
75+
" data.pop(\"img\")\n",
7476
" print(data)\n",
7577
"\n",
7678
"view = mols2grid.display(\n",
@@ -109,7 +111,7 @@
109111
" smi = urllib.parse.quote(data[\"SMILES\"])\n",
110112
" try:\n",
111113
" response = urllib.request.urlopen(url.format(smi))\n",
112-
" except urllib.error.HTTPError:\n",
114+
" except HTTPError:\n",
113115
" print(f\"Could not find corresponding match on PubChem\")\n",
114116
" print(data[\"SMILES\"])\n",
115117
" else:\n",

0 commit comments

Comments
 (0)