Fix hgps.ipynb for Python 2
"print(matplotlib.__version__)"
]
},
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "# This will work on Python 3, but fail on Python 2\n",
- "from pathlib import Path\n",
- "from urllib.request import urlretrieve"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "If you're still using Python 2, please update to Python 3!\n",
- "\n",
- "Also, it's time to start using [JupyterLab](http://jupyterlab.readthedocs.io/)\n",
- "(which is Python 3 only, Jupyter dropped Python 2 support in 2017).\n",
- "\n",
- "But OK, to be honest, actually everything here will work on Python 2,\n",
- "we avoided the use of Python 3 only features for now.\n",
- "You just have to import `Path` and `urlretrieve` from here instead:"
- ]
- },
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"# This will work on Python 2 as well as Python 3\n",
- "# from gammapy.extern.six.moves.urllib.request import urlretrieve\n",
- "# from gammapy.extern.pathlib import Path"
+ "from gammapy.extern.six.moves.urllib.request import urlretrieve\n",
+ "from gammapy.extern.pathlib import Path"
]
},
{
