(Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32)
I'm trying to make a program using pyqt5 and pyodbc.
There are some QLineEdit widgets and QPushButton widgets in a QMainWindow. I wrote a function that connects to accdb file. The function(slot) is connected to a button.
Everything worked fine. I could connect to accdb file and get datas from there. But I found if I type Korean character(Hangul) in QLineEdit, the program stops with exit code -1073741819 (0xC0000005).
Strange thing is that if I call the function in __init__(self) it works fine with no error. But if I call the function by clicking the button, although the code works, typing Korean characters makes the program stop. (Latin characters are OK.)
Similar code worked fine when I used mysql.connector with Maria DB instead of pyodbc. But I have no choice but using accdb file so I tried pyodbc.
code1 below works fine. I can type every characters in QLineEdit widgets.
form_class_main = uic.loadUiType("UI.ui")[0]
class Form_Main(QMainWindow, form_class_main):
def __init__(self):
super().__init__()
self.setupUi(self)
self.test1()
def test1(self):
cnx = pyodbc.connect(connStr)
cnx.close()
print("OK")
code2 below also works fine, before I try to type Korean in QLineEdit widgets.
form_class_main = uic.loadUiType("UI.ui")[0]
class Form_Main(QMainWindow, form_class_main):
def __init__(self):
super().__init__()
self.setupUi(self)
self.btn1.clicked.connect(self.test1)
def test1(self):
cnx = pyodbc.connect(connStr)
cnx.close()
print("OK")
with this code above, If I can type Korean characters in QLineEdit before I click btn1. After clicking the button, (I can do whatever I want but) as soon as I try to type Korean characters in QLineEdit widgets, the program stops.
How could I solve this problem? If there is no solution, is there other way to replace pyodbc?
User contributions licensed under CC BY-SA 3.0