Python程序没有';t处理错误';使用py2exe转换为exe后的

Python程序没有';t处理错误';使用py2exe转换为exe后的,python,mysql,python-3.4,py2exe,Python,Mysql,Python 3.4,Py2exe,我已经为myqsl数据库编写了一个接口,当出现错误时,比如数据库处于脱机状态,它会通过引发自定义错误来处理它,这样我就知道出了什么问题。我对它很满意,并决定将其转换为exe,并使用py2exe实现了这一点。这失败了,经过一些研究,我发现它不再工作了,所以我降级到Python3.4。现在它可以转换,但转换后的程序不再处理错误 我已经检查了是否有正确的mysql连接器,并重新下载了完全相同的连接器,以便将其包括在内,因为我正在处理的错误通常是mysql.connector.error 原始程序中的错

我已经为myqsl数据库编写了一个接口,当出现错误时,比如数据库处于脱机状态,它会通过引发自定义错误来处理它,这样我就知道出了什么问题。我对它很满意,并决定将其转换为exe,并使用py2exe实现了这一点。这失败了,经过一些研究,我发现它不再工作了,所以我降级到Python3.4。现在它可以转换,但转换后的程序不再处理错误

我已经检查了是否有正确的mysql连接器,并重新下载了完全相同的连接器,以便将其包括在内,因为我正在处理的错误通常是mysql.connector.error

原始程序中的错误处理:

import myqsl.connector as mariadb

try:
    mariadb_connection = mariadb.connect(user='root', password='', database='marsmenagerie')
    cursor = mariadb_connection.cursor()
except mariadb.Error:
    clearscreen()
    print("Failed to connect to Database. (Error: 2475JWRT), Contact Censored")
    print("===========================")
    PAUSE()
    exit()
如果应引发此错误,转换程序将创建错误:

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\mysql\connector\network.py", line 525, in open_connection
    self.sock.connect(sockaddr)
ConnectionRefusedError: [WinError 10061] Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\mysql\connector\locales\__init__.py", line 56, in get_client_error
globals(), locals(), ['client_error'])
ImportError: No module named 'mysql.connector.locales.eng'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\mysql\connector\connection.py", line 245, in _open_connection
    self._socket.open_connection()
  File "C:\Python34\lib\site-packages\mysql\connector\network.py", line 528, in open_connection
    errno=2003, values=(self.get_address(), _strioerror(err)))
  File "C:\Python34\lib\site-packages\mysql\connector\errors.py", line 187, in __init__
    self.msg = get_client_error(self.errno)
  File "C:\Python34\lib\site-packages\mysql\connector\locales\__init__.py", line 59, in get_client_error
language))
ImportError: No localization support for language 'eng'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\mysql\connector\network.py", line 148, in send_plain
    self.sock.sendall(packet)
OSError: [WinError 10057] Een aanvraag om gegevens te verzenden of te ontvangen is niet toegestaan omdat de socket niet is verbonden en omdat (tijdens het verzenden op een datagramsocket via een sendto-aanroep) geen adres is opgegeven

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\mysql\connector\locales\__init__.py", line 56, in get_client_error
globals(), locals(), ['client_error'])
ImportError: No module named 'mysql.connector.locales.eng'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\mysql\connector\connection.py", line 102, in __init__
    self.connect(**kwargs)
  File "C:\Python34\lib\site-packages\mysql\connector\abstracts.py", line 731, in connect
    self._open_connection()
  File "C:\Python34\lib\site-packages\mysql\connector\connection.py", line 256, in _open_connection
    self.close()
  File "C:\Python34\lib\site-packages\mysql\connector\connection.py", line 276, in close
    self.cmd_quit()
  File "C:\Python34\lib\site-packages\mysql\connector\connection.py", line 617, in cmd_quit
    self._socket.send(packet, 0, 0)
  File "C:\Python34\lib\site-packages\mysql\connector\network.py", line 151, in send_plain
    errno=2055, values=(self.get_address(), _strioerror(err)))
  File "C:\Python34\lib\site-packages\mysql\connector\errors.py", line 187, in __init__
    self.msg = get_client_error(self.errno)
  File "C:\Python34\lib\site-packages\mysql\connector\locales\__init__.py", line 59, in get_client_error
language))
ImportError: No localization support for language 'eng'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\mysql\connector\network.py", line 148, in send_plain
    self.sock.sendall(packet)
OSError: [WinError 10057] Een aanvraag om gegevens te verzenden of te ontvangen is niet toegestaan omdat de socket niet is verbonden en omdat (tijdens het verzenden op een datagramsocket via een sendto-aanroep) geen adres is opgegeven

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\mysql\connector\locales\__init__.py", line 56, in get_client_error
globals(), locals(), ['client_error'])
ImportError: No module named 'mysql.connector.locales.eng'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "program.py", line 16, in <module>
  File "C:\Python34\lib\site-packages\mysql\connector\__init__.py", line 173, in connect
    return MySQLConnection(*args, **kwargs)
  File "C:\Python34\lib\site-packages\mysql\connector\connection.py", line 105, in __init__
    self.close()
  File "C:\Python34\lib\site-packages\mysql\connector\connection.py", line 276, in close
    self.cmd_quit()
  File "C:\Python34\lib\site-packages\mysql\connector\connection.py", line 617, in cmd_quit
    self._socket.send(packet, 0, 0)
  File "C:\Python34\lib\site-packages\mysql\connector\network.py", line 151, in send_plain
    errno=2055, values=(self.get_address(), _strioerror(err)))
  File "C:\Python34\lib\site-packages\mysql\connector\errors.py", line 187, in __init__
    self.msg = get_client_error(self.errno)
  File "C:\Python34\lib\site-packages\mysql\connector\locales\__init__.py", line 59, in get_client_error
language))
ImportError: No localization support for language 'eng'    
回溯(最近一次呼叫最后一次):
文件“C:\Python34\lib\site packages\mysql\connector\network.py”,第525行,在open\u连接中
self.sock.connect(sockaddr)
ConnectionRefusedError:[WinError 10061]无法在doelcomputer de verbinding Activief heeft geweigerd中进行详细记录
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:\Python34\lib\site packages\mysql\connector\locales\\uuuuu init\uuuuuu.py”,第56行,在get\u client\u错误中
全局变量(),局部变量(),['client_error'])
ImportError:没有名为“mysql.connector.locales.eng”的模块
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:\Python34\lib\site packages\mysql\connector\connection.py”,第245行,在\u open\u connection中
self.\u插座.打开\u连接()
文件“C:\Python34\lib\site packages\mysql\connector\network.py”,第528行,在open\u连接中
errno=2003,value=(self.get\u address(),\u strioerror(err)))
文件“C:\Python34\lib\site packages\mysql\connector\errors.py”,第187行,在\uuu init中__
self.msg=get\u client\u错误(self.errno)
文件“C:\Python34\lib\site packages\mysql\connector\locales\\uuuuu init\uuuuuu.py”,第59行,在get\u client\u错误中
(语文)
ImportError:不支持语言“eng”的本地化
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:\Python34\lib\site packages\mysql\connector\network.py”,第148行,在发送平面中
self.sock.sendall(数据包)
OSError:[WinError 10057]即使是来自te ontvangen的数据,也不需要在omdat中记录插座的数据(通过发送到aanroep的数据集上的数据),也不需要选择地址
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:\Python34\lib\site packages\mysql\connector\locales\\uuuuu init\uuuuuu.py”,第56行,在get\u client\u错误中
全局变量(),局部变量(),['client_error'])
ImportError:没有名为“mysql.connector.locales.eng”的模块
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:\Python34\lib\site packages\mysql\connector\connection.py”,第102行,在\uuu init中__
自我连接(**kwargs)
文件“C:\Python34\lib\site packages\mysql\connector\abstracts.py”,第731行,在connect中
self.\u open\u connection()
文件“C:\Python34\lib\site packages\mysql\connector\connection.py”,第256行,在\u open\u connection中
self.close()
文件“C:\Python34\lib\site packages\mysql\connector\connection.py”,第276行,关闭
self.cmd_quit()
cmd\U quit中第617行的文件“C:\Python34\lib\site packages\mysql\connector\connection.py”
self.\u socket.send(数据包,0,0)
文件“C:\Python34\lib\site packages\mysql\connector\network.py”,第151行,在发送平面中
errno=2055,value=(self.get\u address(),\u strioerror(err)))
文件“C:\Python34\lib\site packages\mysql\connector\errors.py”,第187行,在\uuu init中__
self.msg=get\u client\u错误(self.errno)
文件“C:\Python34\lib\site packages\mysql\connector\locales\\uuuuu init\uuuuuu.py”,第59行,在get\u client\u错误中
(语文)
ImportError:不支持语言“eng”的本地化
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:\Python34\lib\site packages\mysql\connector\network.py”,第148行,在发送平面中
self.sock.sendall(数据包)
OSError:[WinError 10057]即使是来自te ontvangen的数据,也不需要在omdat中记录插座的数据(通过发送到aanroep的数据集上的数据),也不需要选择地址
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:\Python34\lib\site packages\mysql\connector\locales\\uuuuu init\uuuuuu.py”,第56行,在get\u client\u错误中
全局变量(),局部变量(),['client_error'])
ImportError:没有名为“mysql.connector.locales.eng”的模块
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“program.py”,第16行,在
文件“C:\Python34\lib\site packages\mysql\connector\\uuuu init\uuuu.py”,第173行,在connect中
返回MySQLConnection(*args,**kwargs)
文件“C:\Python34\lib\site packages\mysql\connector\connection.py”,第105行,在\uuu init中__
self.close()
文件“C:\Python34\lib\site packages\mysql\connector\connection.py”,第276行,关闭
self.cmd_quit()
cmd\U quit中第617行的文件“C:\Python34\lib\site packages\mysql\connector\connection.py”
self.\u socket.send(数据包,0,0)
文件“C:\Python34\lib\site packages\mysql\connector\network.py”,第151行,在发送平面中
errno=2055,value=(self.get\u address(),\u strioerror(err)))
文件“C:\Python34\lib\site packages\mysql\connector\errors.py”,第187行,在\uuu init中__
self.msg=get\u client\u错误(self.errno)
文件“C:\Python34\lib\site packages\mysql\connector\locales\\uuuuu init\uuuuuu.py”,第59行,在get\u client\u错误中
(语文)
ImportError:不支持语言“eng”的本地化
我知道,它很长。我尽量保持简短
ImportError: No module named 'mysql.connector.locales.eng'