File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 3232 - name : Setup test suite
3333 run : tox run -vv --notest --skip-missing-interpreters false
3434 env :
35+ MAXMINDDB_REQUIRE_EXTENSION : 1
3536 TOX_GH_MAJOR_MINOR : ${{ matrix.env }}
37+ - name : Debug extension import
38+ run : tox exec -e ${{ matrix.env }} -- python debug_import.py
39+ continue-on-error : true
3640 - name : Run test suite
3741 run : tox run --skip-pkg-install
3842 env :
Original file line number Diff line number Diff line change 1+ """Debug script to test extension import."""
2+ import os
3+ import sys
4+ import traceback
5+
6+ print (f"Python version: { sys .version } " )
7+ print (f"Python executable: { sys .executable } " )
8+ print ()
9+
10+ # First, check if maxminddb can be imported at all
11+ try :
12+ import maxminddb
13+ print (f"maxminddb package location: { maxminddb .__file__ } " )
14+ maxminddb_dir = os .path .dirname (maxminddb .__file__ )
15+ print (f"maxminddb directory: { maxminddb_dir } " )
16+ print ()
17+
18+ # List files in maxminddb directory
19+ print ("Files in maxminddb directory:" )
20+ for filename in sorted (os .listdir (maxminddb_dir )):
21+ filepath = os .path .join (maxminddb_dir , filename )
22+ size = os .path .getsize (filepath ) if os .path .isfile (filepath ) else "DIR"
23+ print (f" { filename :50s} { str (size ):>10s} " )
24+ print ()
25+ except Exception as e :
26+ print (f"FAILED to import maxminddb: { e } " )
27+ traceback .print_exc ()
28+ sys .exit (1 )
29+
30+ # Now try to import the extension
31+ try :
32+ import maxminddb .extension as ext
33+ print (f"SUCCESS: Extension imported: { ext } " )
34+ print (f"Extension file: { ext .__file__ } " )
35+ print (f"Has Reader: { hasattr (ext , 'Reader' )} " )
36+ except ImportError as e :
37+ print (f"FAILED: ImportError: { e } " )
38+ print ("\n Full traceback:" )
39+ traceback .print_exc ()
40+ except Exception as e :
41+ print (f"FAILED: Unexpected error: { e } " )
42+ print ("\n Full traceback:" )
43+ traceback .print_exc ()
You can’t perform that action at this time.
0 commit comments