Python Forum
How to programmatically stop a program in Jupyter Notebook?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to programmatically stop a program in Jupyter Notebook?
#1
Hi all,

I just want the program to stop/end when it comes across this line.

First I tried quit() and that didn't work

I then tried exit() and that caused the kernel to die.

import sys, sys.exit() works by raising an exception.

Why is this such a difficult thing? I don't know enough about programming yet to understand why. I've seen many posts about it on SO, here, and elsewhere online. I'm not the only one who gets confused as to how to handle it.

Here's the code:

import pandas as pd
import sys

fran = pd.read_csv(r'C:\Users\Mark\Desktop\FrancesMsg.csv',header=None)

lang_lib = {}

print(fran)
sys.exit()
print("exit didn't work")

for line in fran:
#    line.lstrip()
    line = str(line)
    print(line)
Reply


Messages In This Thread
How to programmatically stop a program in Jupyter Notebook? - by Mark17 - Aug-06-2021, 02:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how come i can't stop program Shi_Shi_Shi_Shi 4 636 Nov-16-2023, 06:20 PM
Last Post: deanhystad
  My code works on Jupyter Lab/Notebook, but NOT on Visual Code Editor jst 4 1,099 Nov-15-2023, 06:56 PM
Last Post: jst
  Navigating file directories and paths inside Jupyter Notebook Mark17 5 757 Oct-29-2023, 12:40 PM
Last Post: Mark17
Question How create programmatically variables ? SpongeB0B 6 1,376 Aug-19-2023, 05:10 AM
Last Post: SpongeB0B
Thumbs Up Python 3 Jupyter notebook ternary plot data nicholas 0 965 Jan-21-2023, 05:01 PM
Last Post: nicholas
  Create Excel Line Chart Programmatically dee 3 1,219 Dec-30-2022, 08:44 PM
Last Post: dee
  Graphs from Jupyter notebook to word Scott 0 911 Nov-28-2022, 06:16 AM
Last Post: Scott
  Opening an empty Jupyter notebook in VSCODE Krischu 3 1,884 Mar-09-2022, 01:57 PM
Last Post: Larz60+
  How to do line continuation in Jupyter Notebook? Mark17 4 5,552 Sep-22-2021, 04:22 PM
Last Post: ibreeden
  Jupyter Notebook as IDE bytecrunch 0 1,622 Sep-12-2021, 07:41 PM
Last Post: bytecrunch

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020