Pytq5 qtdesigner Failed to execute script dosyam.py

merhabalar , programını exe dosyasına çevirince bu uyarıyı alıyorum ,
kodlarım aşağıda ,yardımcı olursanız çok mutlu olurum ,kolay gelsin :slight_smile:
#----------------------LIB--------------------------#
#---------------------------------------------------------#

from PyQt5.QtWidgets import *
from math import *
from designerson2 import *
from dialogson import *

from PyQt5 import QtCore, QtGui, QtWidgets
import sys
import os
import sys, os

def resource_path(relative_path):
if hasattr(sys, ‘_MEIPASS’):
return os.path.join(sys._MEIPASS, relative_path)
return os.path.join(os.path.abspath("."), relative_path)

#import pkg_resources.py2_warn

#----------------------APPLICATION-------------------#
#---------------------------------------------------------#
App=QApplication(sys.argv)
penMain=QMainWindow()
ui=Ui_MainWindow()
ui.setupUi(penMain)
penMain.show()

penDesigner=QDialog()
ui2=Ui_Dialog()
ui2.setupUi(penDesigner)

penDesignerr=QDialog()
ui3=Ui_dialog()
ui3.setupUi(penDesignerr)

#----------------------DATABASE-----------------#
#---------------------------------------------------------#
import sqlite3
global curs
global conn

conn=sqlite3.connect(‘database.db’)
curs=conn.cursor()
sorguCreTblresult=(“CREATE TABLE IF NOT EXISTS results(
Id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
Transformatorty TEXT NOT NULL,
MagneCoreSec TEXT NOT NULL ,
MagneFlux TEXT NOT NULL,
SecPow TEXT NOT NULL,
PrimNumofTurns TEXT NOT NULL,
SecNumofTurns TEXT NOT NULL,
PrimCurrent TEXT NOT NULL,
SecCurrent TEXT NOT NULL,
PrimCondCros TEXT NOT NULL,
SecCondCros TEXT NOT NULL,
PrimCondDia TEXT NOT NULL,
SecCondDia TEXT NOT NULL)”)
curs.execute(sorguCreTblresult)
conn.commit()
#----------------------REGISTER-----------------------------#
#---------------------------------------------------------#
def ADD():
_cmbTranstip=ui.cmbTranstip.currentText()
_lnePower=ui.lnePower.text()
_lnePrimVo=ui.lnePrimVo.text()
_lneSecVo=ui.lneSecVo.text()
_lneMagFie=ui.lneMagFie.text()
_lneCorw=ui.lneCorw.text()
_lneCoreL=ui.lneCoreL.text()
_lineCurrentD=ui.lineCurrentD.text()
_lneFreq=ui.lneFreq.text()
_linePrimCross=ui.linePrimCross.text()
_lineSecCross=ui.lineSecCross.text()

_Mcs = str(float(_lneCorw) * float(_lneCoreL))
_Mf =  str(float(_lneCorw) * float(_lneCoreL)* float(_lneMagFie))
_n =  str(float(_lnePrimVo) / float(_lneSecVo))
_Spow = str(float(_n) * float(_lnePrimVo))
_Pnot =  str(float(_lnePrimVo)*22522522.52 /( float(_lneMagFie)*float(_lneFreq) ))
_Snot = str(float(_Spow)*22522522.52 /( float(_lneMagFie)*float(_lneFreq) ))
_Pcc = str(float(_lnePower) / ((1.732050808 ) * float(_lnePrimVo)))
_Scc = str(float(_Spow) / ((1.732050808 ) * float(_lneSecVo)))
_Pcsection = str(float(_Pcc) / float(_lineCurrentD))
_Secsection =str(float(_Scc) * float(_lineCurrentD))
_d1 = str(sqrt((4 * float(_linePrimCross)) / (3.141592654)))  
_d2 = str(sqrt((4 * float(_lineSecCross)) / (3.141592654)))


         
curs.execute("INSERT INTO results \
                 (Transformatorty,MagneCoreSec,MagneFlux,SecPow,PrimNumofTurns,SecNumofTurns,PrimCurrent,SecCurrent,PrimCondCros,SecCondCros,PrimCondDia,SecCondDia) \
                  VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", \
                  (_cmbTranstip,_Mcs,_Mf,_Spow,_Pnot,_Snot,_Pcc, \
                   _Scc,_Pcsection,_Secsection,_d1,_d2))
conn.commit()

 
LIST()

#----------------------LIST-----------------------------#
#---------------------------------------------------------#

def LIST():

ui.tblresults.clear()
ui.tblresults.setHorizontalHeaderLabels(('Register\nNo',
                                         'Transformatorty\nType',
                                         'Magnetic\n Core\n Section',
                                         'Magnetic\nFlux',
                                         'Seconder\nPower', 
                                         'Primer\nNumber\nof Turns', 
                                         'Seconder\nNumberof Turns', 
                                         'Primer\nConductor\nCurrent', 
                                         'Seconder\nConductor\nCurrent',
                                         'PrimCondCros',
                                         'SecCondCros', 
                                         'Primer\nConductor\nDiameter',
                                         'Seconder\nConductor\nDiameter',))

curs.execute("SELECT * FROM results")

for RowIndeks, RowVariable in enumerate(curs):
    for ColumnIndex, ColumnVariable in enumerate (RowVariable):
        ui.tblresults.setItem(RowIndeks,ColumnIndex,QTableWidgetItem(str(ColumnVariable)))
        
curs.execute("SELECT COUNT(*) FROM results")
kayitSayisi=curs.fetchone()
ui.lblKayitSayisi.setText(str(kayitSayisi[0]))    

LIST()

def REFRESH():
ui.lnePower.clear()
ui.lnePrimVo.clear()
ui.lneSecVo.clear()
ui.lneMagFie.clear()
ui.lneCorw.clear()
ui.lneCoreL.clear()
ui.lineCurrentD.clear()
ui.lneFreq.clear()
ui.linePrimCross.clear()
ui.lineSecCross.clear()

#----------------------EXIT-----------------------------#
#---------------------------------------------------------#
def EXIT():
cevap=QMessageBox.question(penMain,“EXIT”,“Are you sure want to quit the program?”,
QMessageBox.Yes | QMessageBox.No)
if cevap==QMessageBox.Yes:
conn.close()
sys.exit(App.exec_())

else:
    penMain.show()
    ui.statusbar.showMessage("Exit canceled ...",2000)

#----------------------DELETE-----------------------------#
#---------------------------------------------------------#
def DELETE():
cevap=QMessageBox.question(penMain,"DELETE THE REGISTER ",“Are you sure want to delete the record?”,
QMessageBox.Yes | QMessageBox.No)
if cevap==QMessageBox.Yes:

    secili=ui.tblresults.selectedItems()
    silinecek=secili[0].text()
  
    try:
        curs.execute("DELETE FROM results WHERE Id='%s'" %(silinecek)) 
        conn.commit()
        
        LIST()
         
        ui.statusbar.showMessage("REGISTRATION DELETED SUCCESSFULLY...",2000)
    except Exception as Hata:
        ui.statusbar.showMessage("An error such as ...:"+str(Hata))
else:
    ui.statusbar.showMessage("Deletion has been canceled...",2000)

#----------------------ABOUT-----------------------------#
#---------------------------------------------------------#
def ABOUT1():
penDesigner.show()
def ABOUT2():
penDesignerr.show()

#----------------------SIGNAL - SLOT-----------------------------#
#---------------------------------------------------------#
ui.btnEkle.clicked.connect(ADD)
ui.btnCikis.clicked.connect(EXIT)
ui.btnSil.clicked.connect(DELETE)
ui.btnSil_2.clicked.connect(REFRESH)
ui.menuHakkinda.triggered.connect(ABOUT1)
ui.actionWhat.triggered.connect(ABOUT2)
sys.exit(App.exec_())

Merhaba, forumumuza hoşgeldiniz. :slight_smile:

Verdiğiniz kodu, deneyebilmemiz için, kodunuzu şunun gibi düzenlemelisiniz:

```
print(“Bunun gibi…”)
```

Bu sayede biz, kodunuzu şu şekilde göreceğiz:

print("Bunun gibi...")

Olup olmadığını da, “Önizleme” bölmesinden görebilirsiniz.