gpt4 book ai didi

mysql - Cx-卡住 : Showwarning AttributeError: 'NoneType' object has no attribute 'write'

转载 作者:行者123 更新时间:2023-11-29 02:51:03 33 4
gpt4 key购买 nike

脚本在使用 Anaconda 和 Python 3.4 的情况下在源文件上运行良好。当我使用以下安装文件 cxfreeze (v 4.3.4) 时:

from cx_Freeze import setup, Executable

setup(executables=[Executable("main.py", base="Win32GUI")],version='0.2')

我在服务器上遇到以下错误:

DBOps.py", line 54, in executemany

"C:\Users\user\Anaconda3\lib\site-packages\MySQLdb\cursors.py", line286, in executemany File

"FileC:\Users\user\Anaconda3\lib\site-packages\MySQLdb\cursors.py", line 127, in _warning_check File "c:\Python\64-bit\3.4\lib\warnings.py",

line 15, in showwarning AttributeError: 'NoneType' object has no attribute 'write'

我想我的系统上安装的不同 python 版本可能会导致这个问题,使用安装程序删除它们。没有改变。服务器和本地计算机上的相同错误。错误的部分看起来像“c:\Python\64-bit\3.4\lib\warnings.py”,因为在我的系统或服务器上都没有这样的目录路径。

最佳答案

这是 Thomas Kluyver 的相关解决方案:

The bigger issue there is that anything that attempts to show a warning will cause an error, because by default it tries to write warnings to sys.stderr, and if you use the Win32GUI base, there's no stderr to write to. Calling warnings.simplefilter('ignore') beforehand should prevent that.

来源:https://bitbucket.org/anthony_tuininga/cx_freeze/issues/81/python-34-venv-importlib-attributeerror

关于mysql - Cx-卡住 : Showwarning AttributeError: 'NoneType' object has no attribute 'write' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35772441/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com