What does "Process finished with exit code 1" mean?
Question:
I tried to develop a simple currency program but I have a problem. When I click on Çevir
, the program should calculate money (like an exchange). But I can’t do it. PyCharm writes Process finished with exit code 1
when I click Çevir
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import qApp
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
....(qtdesigner codes . i skip this part)
self.pushButton.clicked.connect(self.cevirici)
self.pushButton_2.clicked.connect(self.cikis)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.label_2.setText(_translate("MainWindow", "Birinci Döviz"))
self.label.setText(_translate("MainWindow", "İkinci Döviz"))
self.label_3.setText(_translate("MainWindow", "Miktar"))
self.label_4.setText(_translate("MainWindow", "Sonuç :"))
self.pushButton.setText(_translate("MainWindow", "Çevir"))
self.pushButton_2.setText(_translate("MainWindow", "Çıkış Yap"))
def cevirici(self):
import requests
import sys
url = "http://api.fixer.io/latest?base="
birinci_doviz = self.comboBox.currentText()
ikinci_doviz = self.comboBox_2.currentText()
miktar = int(self.lineEdit.currentText())
response = requests.get(url + birinci_doviz)
json_verisi = response.json()
self.lineEdit_2.setText(json_verisi["rates"][ikinci_doviz] * miktar)
def cikis(self):
qApp.quit()
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
Answers:
0
and 1
are exit codes, and they are not necessarily python specific, in fact they are very common.
exit code (0)
means an exit without errors or issues.
exit code (1)
means there was some issue / problem which caused the program to exit.
The effect of each of these codes can vary between operating systems, but with Python should be fairly consistent.
0
and 1
are exit codes.
exit code (0)
means an exit without an errors or any issues, can be a compile time error or any dependency issue.
exit code (1)
means there was some issue which caused the program to exit. For example if your program is running on port :8080
and that port is currently in used or not closed, then you code ends up with exit code 1
Scroll up in your run screen of pycharm.
A bug problably printed the exit exception somewhere in the middle of your printlines. This makes it look your program ran normally and suddenly exit with code 1.
I tried to develop a simple currency program but I have a problem. When I click on Çevir
, the program should calculate money (like an exchange). But I can’t do it. PyCharm writes Process finished with exit code 1
when I click Çevir
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import qApp
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
....(qtdesigner codes . i skip this part)
self.pushButton.clicked.connect(self.cevirici)
self.pushButton_2.clicked.connect(self.cikis)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.label_2.setText(_translate("MainWindow", "Birinci Döviz"))
self.label.setText(_translate("MainWindow", "İkinci Döviz"))
self.label_3.setText(_translate("MainWindow", "Miktar"))
self.label_4.setText(_translate("MainWindow", "Sonuç :"))
self.pushButton.setText(_translate("MainWindow", "Çevir"))
self.pushButton_2.setText(_translate("MainWindow", "Çıkış Yap"))
def cevirici(self):
import requests
import sys
url = "http://api.fixer.io/latest?base="
birinci_doviz = self.comboBox.currentText()
ikinci_doviz = self.comboBox_2.currentText()
miktar = int(self.lineEdit.currentText())
response = requests.get(url + birinci_doviz)
json_verisi = response.json()
self.lineEdit_2.setText(json_verisi["rates"][ikinci_doviz] * miktar)
def cikis(self):
qApp.quit()
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
0
and 1
are exit codes, and they are not necessarily python specific, in fact they are very common.
exit code (0)
means an exit without errors or issues.
exit code (1)
means there was some issue / problem which caused the program to exit.
The effect of each of these codes can vary between operating systems, but with Python should be fairly consistent.
0
and 1
are exit codes.
exit code (0)
means an exit without an errors or any issues, can be a compile time error or any dependency issue.
exit code (1)
means there was some issue which caused the program to exit. For example if your program is running on port :8080
and that port is currently in used or not closed, then you code ends up with exit code 1
Scroll up in your run screen of pycharm.
A bug problably printed the exit exception somewhere in the middle of your printlines. This makes it look your program ran normally and suddenly exit with code 1.