Skip to content

Commit

Permalink
Debug jpyutil
Browse files Browse the repository at this point in the history
  • Loading branch information
jmao-denver committed Oct 24, 2024
1 parent 8291793 commit 6e49f85
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions jpyutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
# This way importing jpyutil does not interfere with logging in other modules
logger = logging.getLogger('jpyutil')
# Get log level from environment variable JPY_LOG_LEVEL. Default to INFO
os.environ['JPY_LOG_LEVEL'] = 'DEBUG'
log_level = os.getenv('JPY_LOG_LEVEL', 'INFO')
try:
logger.setLevel(getattr(logging, log_level))
Expand Down Expand Up @@ -306,6 +307,10 @@ def _find_python_dll_file(fail=False):

search_dirs = [sys.prefix]

for name in PYTHON_LIB_DIR_CONFIG_VAR_NAMES:
value = sysconfig.get_config_var(name)
print(f"Checking {name} for Python shared library: {value}")

extra_search_dirs = [sysconfig.get_config_var(name) for name in PYTHON_LIB_DIR_CONFIG_VAR_NAMES]
for extra_dir in extra_search_dirs:
if extra_dir and extra_dir not in search_dirs and os.path.exists(extra_dir):
Expand All @@ -328,6 +333,7 @@ def _find_python_dll_file(fail=False):

vmaj = str(sys.version_info.major)
vmin = str(sys.version_info.minor)
print(f"Python version: {vmaj}.{vmin}")

if platform.system() == 'Windows':
versions = (vmaj + vmin, vmaj, '')
Expand All @@ -346,6 +352,7 @@ def _find_python_dll_file(fail=False):
if python_dll_path:
return python_dll_path

print("try ctypes.util.find_library", PYTHON_LIB_NAME)
python_dll_path = ctypes.util.find_library(PYTHON_LIB_NAME)
if python_dll_path:
logger.debug(
Expand Down

0 comments on commit 6e49f85

Please sign in to comment.