Python意外退出- pyodbc, odbc 17 [macOS]



在尝试执行脚本的python部分时:

df.to_sql(
name='my_table_name',
con=<my_connection_engine>,
schema='my_db',
if_exists='replace',
index=False
)

我总是在终端中收到这个错误,我开始我的脚本:Abort trap: 6和这个错误在一个弹出窗口:

Process:               Python [14664]
Path:                  /usr/local/Cellar/python@3.8/3.8.12/Frameworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python
Identifier:            Python
Version:               3.8.12 (3.8.12)
Code Type:             X86-64 (Native)
Parent Process:        bash [12427]
Responsible:           iTerm2 [613]
User ID:               1642609906
Date/Time:             2021-10-08 11:43:34.645 -0700
OS Version:            macOS 11.6 (20G165)
Report Version:        12
Bridge OS Version:     5.5 (18P4759a)
Anonymous UUID:        71134995-EF62-4BAE-8282-F44382EC8013
Sleep/Wake UUID:       ED33DADE-1A68-4817-B8A4-BDA790C539D6
Time Awake Since Boot: 18000 seconds
Time Since Wake:       4500 seconds
System Integrity Protection: enabled
Crashed Thread:        0  Dispatch queue: com.apple.main-thread
Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY
Application Specific Information:
stack buffer overflow
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff2044d92e __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fff2047c5bd pthread_kill + 263
2   libsystem_c.dylib               0x00007fff203d14a0 __abort + 139
3   libsystem_c.dylib               0x00007fff203ab969 __stack_chk_fail + 100
4   libodbc.2.dylib                 0x000000011cb6bba9 SQLGetDiagRecW + 2210
5   pyodbc.cpython-38-darwin.so     0x000000011cb14eb2 GetDiagRecs(Cursor*) + 226
6   pyodbc.cpython-38-darwin.so     0x000000011cb142d5 execute(Cursor*, _object*, _object*, bool) + 437
7   org.python.python               0x000000010e90c03e method_vectorcall_VARARGS + 270
8   org.python.python               0x000000010e9a5875 call_function + 346
9   org.python.python               0x000000010e9a258d _PyEval_EvalFrameDefault + 29600
10  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
11  org.python.python               0x000000010e9055c3 _PyFunction_Vectorcall + 227
12  org.python.python               0x000000010e9a5875 call_function + 346
13  org.python.python               0x000000010e9a258d _PyEval_EvalFrameDefault + 29600
14  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
15  org.python.python               0x000000010e9055c3 _PyFunction_Vectorcall + 227
16  org.python.python               0x000000010e9a5875 call_function + 346
17  org.python.python               0x000000010e9a258d _PyEval_EvalFrameDefault + 29600
18  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
19  org.python.python               0x000000010e9055c3 _PyFunction_Vectorcall + 227
20  org.python.python               0x000000010e907505 method_vectorcall + 135
21  org.python.python               0x000000010e9a5875 call_function + 346
22  org.python.python               0x000000010e9a2722 _PyEval_EvalFrameDefault + 30005
23  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
24  org.python.python               0x000000010e9055c3 _PyFunction_Vectorcall + 227
25  org.python.python               0x000000010e9a5875 call_function + 346
26  org.python.python               0x000000010e9a258d _PyEval_EvalFrameDefault + 29600
27  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
28  org.python.python               0x000000010e9055c3 _PyFunction_Vectorcall + 227
29  org.python.python               0x000000010e904ea5 PyVectorcall_Call + 108
30  org.python.python               0x000000010e9a2914 _PyEval_EvalFrameDefault + 30503
31  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
32  org.python.python               0x000000010e9055c3 _PyFunction_Vectorcall + 227
33  org.python.python               0x000000010e9a5875 call_function + 346
34  org.python.python               0x000000010e9a258d _PyEval_EvalFrameDefault + 29600
35  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
36  org.python.python               0x000000010e9055c3 _PyFunction_Vectorcall + 227
37  org.python.python               0x000000010e9a5875 call_function + 346
38  org.python.python               0x000000010e9a258d _PyEval_EvalFrameDefault + 29600
39  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
40  org.python.python               0x000000010e9055c3 _PyFunction_Vectorcall + 227
41  org.python.python               0x000000010e9a5875 call_function + 346
42  org.python.python               0x000000010e9a258d _PyEval_EvalFrameDefault + 29600
43  org.python.python               0x000000010e90545e function_code_fastcall + 106
44  org.python.python               0x000000010e9a5875 call_function + 346
45  org.python.python               0x000000010e9a258d _PyEval_EvalFrameDefault + 29600
46  org.python.python               0x000000010e90545e function_code_fastcall + 106
47  org.python.python               0x000000010e9a5875 call_function + 346
48  org.python.python               0x000000010e9a258d _PyEval_EvalFrameDefault + 29600
49  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
50  org.python.python               0x000000010e9055c3 _PyFunction_Vectorcall + 227
51  org.python.python               0x000000010e907505 method_vectorcall + 135
52  org.python.python               0x000000010e9a5875 call_function + 346
53  org.python.python               0x000000010e9a2722 _PyEval_EvalFrameDefault + 30005
54  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
55  org.python.python               0x000000010e9055c3 _PyFunction_Vectorcall + 227
56  org.python.python               0x000000010e9075f2 method_vectorcall + 372
57  org.python.python               0x000000010e904ea5 PyVectorcall_Call + 108
58  org.python.python               0x000000010e9a2914 _PyEval_EvalFrameDefault + 30503
59  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
60  org.python.python               0x000000010e9055c3 _PyFunction_Vectorcall + 227
61  org.python.python               0x000000010e9a5875 call_function + 346
62  org.python.python               0x000000010e9a2722 _PyEval_EvalFrameDefault + 30005
63  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
64  org.python.python               0x000000010e9055c3 _PyFunction_Vectorcall + 227
65  org.python.python               0x000000010e907505 method_vectorcall + 135
66  org.python.python               0x000000010e9a5875 call_function + 346
67  org.python.python               0x000000010e9a2722 _PyEval_EvalFrameDefault + 30005
68  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
69  org.python.python               0x000000010e9055c3 _PyFunction_Vectorcall + 227
70  org.python.python               0x000000010e9a5875 call_function + 346
71  org.python.python               0x000000010e9a265f _PyEval_EvalFrameDefault + 29810
72  org.python.python               0x000000010e9a63bc _PyEval_EvalCodeWithName + 1992
73  org.python.python               0x000000010e99b14a PyEval_EvalCode + 51
74  org.python.python               0x000000010e9d40d1 run_eval_code_obj + 102
75  org.python.python               0x000000010e9d335c run_mod + 82
76  org.python.python               0x000000010e9d3489 pyrun_file + 133
77  org.python.python               0x000000010e9d1c16 PyRun_SimpleFileExFlags + 652
78  org.python.python               0x000000010e9e925b Py_RunMain + 1870
79  org.python.python               0x000000010e9e95a2 pymain_main + 306
80  org.python.python               0x000000010e9e95f0 Py_BytesMain + 42
81  libdyld.dylib                   0x00007fff20497f3d start + 1
Thread 1:
0   libsystem_kernel.dylib          0x00007fff20449cde __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff2047ce49 _pthread_cond_wait + 1298
2   libopenblas.0.dylib             0x000000010f6eaa9f blas_thread_server + 207
3   libsystem_pthread.dylib         0x00007fff2047c8fc _pthread_start + 224
4   libsystem_pthread.dylib         0x00007fff20478443 thread_start + 15
Thread 2:
0   libsystem_kernel.dylib          0x00007fff20449cde __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff2047ce49 _pthread_cond_wait + 1298
2   libopenblas.0.dylib             0x000000010f6eaa9f blas_thread_server + 207
3   libsystem_pthread.dylib         0x00007fff2047c8fc _pthread_start + 224
4   libsystem_pthread.dylib         0x00007fff20478443 thread_start + 15
Thread 3:
0   libsystem_kernel.dylib          0x00007fff20449cde __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff2047ce49 _pthread_cond_wait + 1298
2   libopenblas.0.dylib             0x000000010f6eaa9f blas_thread_server + 207
3   libsystem_pthread.dylib         0x00007fff2047c8fc _pthread_start + 224
4   libsystem_pthread.dylib         0x00007fff20478443 thread_start + 15
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000  rbx: 0x0000000116580e00  rcx: 0x00007ffee1324cb8  rdx: 0x0000000000000000
rdi: 0x0000000000000103  rsi: 0x0000000000000006  rbp: 0x00007ffee1324ce0  rsp: 0x00007ffee1324cb8
r8: 0x0000000000000000   r9: 0x0000000000000000  r10: 0x0000000116580e00  r11: 0x0000000000000246
r12: 0x0000000000000103  r13: 0x00007fb5dec7b7e0  r14: 0x0000000000000006  r15: 0x0000000000000016
rip: 0x00007fff2044d92e  rfl: 0x0000000000000246  cr2: 0x00000001164a8000

Logical CPU:     0
Error Code:      0x02000148
Trap Number:     133
Thread 0 instruction stream not available.
Thread 0 last branch register state not available.

Binary Images:
<...>

我正在使用macOS: BigSur 11.6和OpenSSL 1.1.1(无论如何openssl version返回LibreSSL 2.8.3)。

  • cat ~/.bash_profile返回:
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/openssl@1.1/bin:$PATH"
export CPATH="/usr/local/opt/openssl@1.1/include"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
export LIBRARY_PATH="/usr/local/opt/openssl@1.1/lib"
export DYLD_LIBRARY_PATH="/usr/local/opt/openssl@1.1/lib"
export DYLD_FALLBACK_LIBRARY_PATH="/usr/local/opt/openssl@1.1/lib"
  • cat ~/.profile返回:
export CLASSPATH=${CLASSPATH}:/Library/Java/Extensions/sqljdbc_9.4/enu/mssql-jdbc-9.4.0.jre16.jar;
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home;
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/openssl@1.1/bin:$PATH"
  • cat ~/.bashrc返回:
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/openssl@1.1/bin:$PATH"

我重新安装了多次openssl库,brew本身,ODBC驱动程序。我还用这些命令创建了符号链接:

sudo ln -sfn /usr/local/Cellar/openssl@1.1/1.1.1l_1/lib/libssl.dylib  /usr/local/lib/libssl.dylib
sudo ln -sfn /usr/local/Cellar/openssl@1.1/1.1.1l_1/lib/libcrypto.dylib  /usr/local/lib/libcrypto.dylib

我手动从~/.bash_profile,~/.bashrc~/.profile导出所有变量,运行source ~/.bash_profile。改变openssl@1.1openssl@3openssl(之前我删除这个文件夹)。

我试图用这些来源的答案来解决这个问题:

  • https://bugs.python.org/issue36154
  • macOS Catalina: Python Quit unexpected error

所有这些都没有帮助。请帮我解决这个问题。

我也面临同样的问题。我想到的唯一解决办法是在ubuntu上构建一个docker映像并在其中运行应用程序。

这似乎来自正在执行的SQL语句中未处理的ANSI警告。

通过使用set ansi_warnings off;关闭这些语句来启动语句,为我修复了这个问题。

相关内容

  • 没有找到相关文章

最新更新