I can connect to Postgres via the command line without problems, however, if I try to connect via Python using the psycopg2 module, I will get the error below. Interestingly, I just tried connecting to PSeqal.app and it crashes with the same error.
Environment:
- MacOS: 10.13.3
- Xcode 9.2
- Python: 3.6.4
- Connection Module: psycopg2
- Postgresql: 10.3
Script:
Here is my simple script connection that tries to connect via Python to Postgresql:
def connect(self, params): """ Connect to the PostgreSQL database server """ conn = None try:
Error:
Script output:
$ python3 testdb.py
Illegal Instruction: 4
Apple error (partial):
Process: Python [79534] Path: /usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python Identifier: Python Version: 3.6.4 (3.6.4) Code Type: X86-64 (Native) Parent Process: bash [657] Responsible: Python [79534] User ID: 501 Date/Time: 2018-03-02 15:30:27.642 +1300 OS Version: Mac OS X 10.13.3 (17D102) Report Version: 12 Anonymous UUID: xx Time Awake Since Boot: 21000 seconds System Integrity Protection: disabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Signal: Illegal instruction: 4 Termination Reason: Namespace SIGNAL, Code 0x4 Terminating Process: exc handler [0] Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libpq.5.10.dylib 0x00000001118e8d27 initPQExpBuffer + 32 1 libpq.5.10.dylib 0x00000001118dba93 PQconninfoParse + 43 2 _psycopg.cpython-36m-darwin.so 0x0000000111897cf1 psyco_parse_dsn + 113 3 org.python.python 0x000000010fd4681a _PyCFunction_FastCallDict + 463 4 org.python.python 0x000000010fdaad8e call_function + 489 5 org.python.python 0x000000010fda3c43 _PyEval_EvalFrameDefault + 4811 6 org.python.python 0x000000010fdab4f0 _PyEval_EvalCodeWithName + 1719 7 org.python.python 0x000000010fda293d PyEval_EvalCodeEx + 57 8 org.python.python 0x000000010fd2ec76 function_call + 339 9 org.python.python 0x000000010fd0e9f2 PyObject_Call + 101 10 org.python.python 0x000000010fda3eac _PyEval_EvalFrameDefault + 5428 11 org.python.python 0x000000010fdab4f0 _PyEval_EvalCodeWithName + 1719 12 org.python.python 0x000000010fda293d PyEval_EvalCodeEx + 57 13 org.python.python 0x000000010fd2ec76 function_call + 339 14 org.python.python 0x000000010fd0e9f2 PyObject_Call + 101 15 org.python.python 0x000000010fda3eac _PyEval_EvalFrameDefault + 5428 16 org.python.python 0x000000010fdabe93 _PyFunction_FastCall + 121 17 org.python.python 0x000000010fdaad65 call_function + 448 18 org.python.python 0x000000010fda3c43 _PyEval_EvalFrameDefault + 4811 19 org.python.python 0x000000010fdabe93 _PyFunction_FastCall + 121 20 org.python.python 0x000000010fd0eb71 _PyObject_FastCallDict + 196 21 org.python.python 0x000000010fd0ec94 _PyObject_Call_Prepend + 156 22 org.python.python 0x000000010fd0e9f2 PyObject_Call + 101 23 org.python.python 0x000000010fd598ae slot_tp_init + 57 24 org.python.python 0x000000010fd5683c type_call + 184 25 org.python.python 0x000000010fd0eb3c _PyObject_FastCallDict + 143 26 org.python.python 0x000000010fdaad5e call_function + 441 27 org.python.python 0x000000010fda3c43 _PyEval_EvalFrameDefault + 4811 28 org.python.python 0x000000010fdabe93 _PyFunction_FastCall + 121 29 org.python.python 0x000000010fd0eb71 _PyObject_FastCallDict + 196 30 org.python.python 0x000000010fd0ec94 _PyObject_Call_Prepend + 156 31 org.python.python 0x000000010fd0e9f2 PyObject_Call + 101 32 org.python.python 0x000000010fd598ae slot_tp_init + 57 33 org.python.python 0x000000010fd5683c type_call + 184 34 org.python.python 0x000000010fd0eb3c _PyObject_FastCallDict + 143 35 org.python.python 0x000000010fdaad5e call_function + 441 36 org.python.python 0x000000010fda3c43 _PyEval_EvalFrameDefault + 4811 37 org.python.python 0x000000010fdab4f0 _PyEval_EvalCodeWithName + 1719 38 org.python.python 0x000000010fda28fe PyEval_EvalCode + 42 39 org.python.python 0x000000010fdcb24e run_mod + 54 40 org.python.python 0x000000010fdca26f PyRun_FileExFlags + 160 41 org.python.python 0x000000010fdc994c PyRun_SimpleFileExFlags + 285 42 org.python.python 0x000000010fddd770 Py_Main + 3484 43 org.python.python 0x000000010fd01e1d 0x10fd00000 + 7709 44 libdyld.dylib 0x00007fff6c260115 start + 1 Thread 0 crashed with X86 Thread State (64-bit): rax: 0x00007f86c3db9200 rbx: 0x00007ffedfefe3a0 rcx: 0x0000000000000100 rdx: 0x0000000000010000 rdi: 0x0000000000000b93 rsi: 0x00000000ffff0001 rbp: 0x00007ffedfefe390 rsp: 0x00007ffedfefe380 r8: 0x000000006c3db930 r9: 0x000000000000000f r10: 0x00000000ffff0000 r11: 0x00007f86c3d00000 r12: 0x0000000110665738 r13: 0x0000000111c68510 r14: 0x0000000111cb80b0 r15: 0x00007ffedfefe3a0 rip: 0x00000001118e8d27 rfl: 0x0000000000010206 cr2: 0x00000001118ef90e Logical CPU: 2 Error Code: 0x00000000 Trap Number: 6
What I have tried so far:
- Updated Python to 3.6.4 from 3.5.1
- Restore all dependent libraries, including psycopg2, to make sure they are compatible with High Sierra (hopefully)
- Reinstall Postgres from scratch
- Updated Xcode + Tools
So, I lost a little, what to try next? Anyone else come across this? Any pointers to where to look? Anything that will help me get this job will be greatly appreciated!
source share