问题
I am beginner in Python. I tried to develop simple currency program but i have problem. can someone helps me ? When i click "Çevir" , program should calculate money(like exchange). But i cant do it. PyCharm write "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_())
回答1:
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 an 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.
回答2:
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
来源:https://stackoverflow.com/questions/47970844/what-is-process-finished-with-exit-code-1-mean