ipython

Reset underscore (`_`) variable in Jupyter notebook powered by IPython kernel

ε祈祈猫儿з 提交于 2020-05-28 03:07:46
问题 Edit : The issue has been reported in GitHub. I'm leaving the question here in case it helps other people find the issue (I was not able to). I often use the _ variable for convenience when working in a Jupyter notebook (it returns the output of the latest code execution). However, when _ is used to as a placeholder for an unused variable (a typical use case in Python), it breaks the first use case. Note that this works as expected in an IPython console. Below, _ again holds the latest

Reset underscore (`_`) variable in Jupyter notebook powered by IPython kernel

感情迁移 提交于 2020-05-28 03:05:18
问题 Edit : The issue has been reported in GitHub. I'm leaving the question here in case it helps other people find the issue (I was not able to). I often use the _ variable for convenience when working in a Jupyter notebook (it returns the output of the latest code execution). However, when _ is used to as a placeholder for an unused variable (a typical use case in Python), it breaks the first use case. Note that this works as expected in an IPython console. Below, _ again holds the latest

How can i force SHIFT+ENTER to run selection and execute it immediately running ipython in vscode?

浪尽此生 提交于 2020-05-26 08:01:26
问题 I have added the setting below in vscode to launch ipython when i used shift+enter to run selection. "python.terminal.launchArgs": [ "-c", "\"from IPython import start_ipython; start_ipython()\"" ] Now when i run a selection, the code will not execute in the terminal immediately, i need to navigate to the terminal and hit enter until it does. This problem doesn't occur if i just use the basic python terminal to execute single lines. Is there a setting to fix this so the snippet runs

How can i force SHIFT+ENTER to run selection and execute it immediately running ipython in vscode?

雨燕双飞 提交于 2020-05-26 07:57:30
问题 I have added the setting below in vscode to launch ipython when i used shift+enter to run selection. "python.terminal.launchArgs": [ "-c", "\"from IPython import start_ipython; start_ipython()\"" ] Now when i run a selection, the code will not execute in the terminal immediately, i need to navigate to the terminal and hit enter until it does. This problem doesn't occur if i just use the basic python terminal to execute single lines. Is there a setting to fix this so the snippet runs

How do I run globally installed Jupyter from within virtual environments?

一曲冷凌霜 提交于 2020-05-26 06:11:31
问题 I'm trying to run Jupyter notebooks with a globally installed version of Jupyter from within virtual environments (using virtualenvwrapper , because I want to manage versions of installed packages). And I do not what to use Anaconda. The problem is when I run jupyter notebook from within the virtualenv, it cannot find the packages installed in the env, it only finds the packages installed globally. How do I set up Jupyter to check for packages installed within the virtual environment instead

Logging module does not print in IPython

孤人 提交于 2020-05-25 19:59:14
问题 The following code does print 'I want this to print' in 'ipython qtconsole', however it does not print in plain IPython. import logging import logging.handlers log = logging.getLogger() f = logging.Formatter("%(asctime)s - %(module)s. %(funcName)s - %(levelname)s - %(message)s") fh = logging.handlers.TimedRotatingFileHandler('log.txt', 'W6') fh.setFormatter(f) log.addHandler(fh) log.setLevel(logging.INFO) log.info('I want this to print') In 'IPython qtconsole' however i get different problems

Automatic cell execution timing in jupyter lab

℡╲_俬逩灬. 提交于 2020-05-25 07:15:25
问题 In jupyter notebook , I can configure an automatic cell timing with nbextensions, the result is like so: How can i do this in jupyter lab ? I didn't found any extensions that did a similar thing. Obs.: I know that a similar result can be achieved with %%time magic, but i want it to be automatic, so I don't have to place the magic function at the begining of each cell 回答1: Requirement JupyterLab >= 2.0.2 Let's move step by step Extension availabel in jupyter lab is jupyterlab-execute-time

Passing Ipython variables as string arguments to shell command

无人久伴 提交于 2020-05-17 04:23:34
问题 How do I execute a shell command from Ipython/Jupyter notebook passing the value of a python string variable as a string in the bash argument like in this example: sp_name = 'littleGuy' #the variable sp_details = !az ad app list --filter "DisplayName eq '$sp_name'" #the shell command I've tried using $sp_name alone, ${sp_name} , {sp_name} etc as outlined in this related question, but none have worked. The kicker here is the variable name needs to be quoted as a string in the shell command.

Passing Ipython variables as string arguments to shell command

耗尽温柔 提交于 2020-05-17 04:23:05
问题 How do I execute a shell command from Ipython/Jupyter notebook passing the value of a python string variable as a string in the bash argument like in this example: sp_name = 'littleGuy' #the variable sp_details = !az ad app list --filter "DisplayName eq '$sp_name'" #the shell command I've tried using $sp_name alone, ${sp_name} , {sp_name} etc as outlined in this related question, but none have worked. The kicker here is the variable name needs to be quoted as a string in the shell command.

Passing Ipython variables as string arguments to shell command

大城市里の小女人 提交于 2020-05-17 04:22:11
问题 How do I execute a shell command from Ipython/Jupyter notebook passing the value of a python string variable as a string in the bash argument like in this example: sp_name = 'littleGuy' #the variable sp_details = !az ad app list --filter "DisplayName eq '$sp_name'" #the shell command I've tried using $sp_name alone, ${sp_name} , {sp_name} etc as outlined in this related question, but none have worked. The kicker here is the variable name needs to be quoted as a string in the shell command.