簡體   English   中英

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

[英]Python quit unexpectedly - 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.1l(無論如何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@3 ,只是openssl (之前我刪除此文件夾)。

我試圖用這些來源的答案來解決這個問題:

所有這些都沒有幫助。 請幫我解決這個問題。

我面臨着完全相同的問題。 我想出的唯一解決方法是在 ubuntu 上構建一個 docker 映像並在其中運行應用程序。

這似乎來自正在執行的 SQL 語句中未處理的 ANSI 警告。

通過使用set ansi_warnings off;這些語句來啟動語句set ansi_warnings off; 為我解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM