Restart ipython Kernel with a command from a cell
As Thomas K. suggested, here is the way to restart the ipython
kernel from your keyboard:
import os
os._exit(00)
Reset an IPython kernel without restarting
I used the %reset
IPython magic function instead of restarting the kernel. That removes all the variables but does not perform again the imports. That is suitable for my application.
See IPython docs: http://ipython.readthedocs.org/en/stable/interactive/magics.html?highlight=magic#magic-reset
Restarting kernel, ipython console in spyder
I found the issue, I had sys.exit() in my EndProgram() function as well as at the end of my code as seen here: sys.exit(app.exec_()). Once I took out the sys.exit() in my EndProgram function and changed sys.exit(app.exec_()) to sys.exit(), it is working perfect.
Original Code
if __name__ == '__main__':
# from LoadIceberg2 import LoadData2
app = Application(sys.argv)
gui = ProgramGUI()
qr = gui.frameGeometry()
cp = QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
gui.move(qr.topLeft())
# app.processEvents()
npics=8
gui.show()
# behaviour to trigger on exit
sys.exit(app.exec_())
New code
if __name__ == '__main__':
# from LoadIceberg2 import LoadData2
app = Application(sys.argv)
gui = ProgramGUI()
qr = gui.frameGeometry()
cp = QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
gui.move(qr.topLeft())
# app.processEvents()
npics=8
gui.show()
# behaviour to trigger on exit
sys.exit()
Related Topics
How to Find Which Version of Tensorflow Is Installed in My System
Counting Non Zero Values in Each Column of a Dataframe in Python
Parentheses and Quotation Marks in Output
How to Extract List from List of Lists When Any One Element Match With Another List'S Element
How to Convert Data from Txt Files to Excel Files Using Python
Python Ttk Treeview: How to Select and Set Focus on a Row
How to Merge 2 CSV Files Together by Multiple Columns in Python
How to Find the Average Colour of an Image in Python With Opencv
Split/Explode a Column of Dictionaries into Separate Columns With Pandas
Convert CSV to Parquet File Using Python
Python Selenium - Element Is Not Currently Interactable and May Not Be Manipulated
How to Kill a While Loop With a Keystroke
How to Add List into a New Column in CSV - Python
How to Check Whether a Number Is Divisible by Another Number
Use Variable as Key Name in Python Dictionary
Making a Dictionary from Each Line in a File
Pandas Counting and Summing Specific Conditions
Numpy Array Typeerror: Only Integer Scalar Arrays Can Be Converted to a Scalar Index