“ImportError: No module named” when trying to run Python script

I’m trying to run a script that launches, amongst other things, a python script. I get a ImportError: No module named …, however, if I launch ipython and import the same module in the same way through the interpreter, the module is accepted. What’s going on, and how can I fix it? I’ve tried to … Read more

Import local function from a module housed in another directory with relative imports in Jupyter Notebook using Python 3

I have a directory structure similar to the following meta_project project1 __init__.py lib module.py __init__.py notebook_folder notebook.jpynb When working in notebook.jpynb if I try to use a relative import to access a function function() in module.py with: from ..project1.lib.module import function I get the following error: SystemError Traceback (most recent call last) <ipython-input-7-6393744d93ab> in <module>() … Read more

How to embed HTML into IPython output?

Is it possible to embed rendered HTML output into IPython output? One way is to use from IPython.core.display import HTML HTML(‘<a href=”http://example.com”>link</a>’) or (IPython multiline cell alias) %%html <a href=”http://example.com”>link</a> Which return a formatted link, but This link doesn’t open a browser with the webpage itself from the console. IPython notebooks support honest rendering, though. … Read more

How to load/edit/run/save text files (.py) into an IPython notebook cell?

I’ve recently moved over to using IPython notebooks as part of my workflow. However, I’ve not been successful in finding a way to import .py files into the individual cells of an open IPython notebook so that they can edited, run and then saved. Can this be done? I’ve found this in the documentation which … Read more

How to prevent Google Colab from disconnecting?

Q: Is there any way to programmatically prevent Google Colab from disconnecting on a timeout? The following describes the conditions causing a notebook to automatically disconnect: Google Colab notebooks have an idle timeout of 90 minutes and absolute timeout of 12 hours. This means, if user does not interact with his Google Colab notebook for … Read more