From 27abc262897dea1d26f186102efaa5d4b41f925b Mon Sep 17 00:00:00 2001 From: Aki Ariga Date: Sun, 10 Sep 2023 14:41:26 -0700 Subject: [PATCH] chore: suppress warning for tabula-py generated java_options --- tabula/io.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tabula/io.py b/tabula/io.py index 5f29fd4..ed5c575 100644 --- a/tabula/io.py +++ b/tabula/io.py @@ -63,10 +63,18 @@ def _run( options, as well as an optional path to pass to tabula-java as a regular argument to use for any required output sent to stderr. """ + # Ignore some options that are set by tabula-py + IGNORED_JAVA_OPTIONS = { + "-Djava.awt.headless=true", + "-Dfile.encoding=UTF8", + "-Dorg.slf4j.simpleLogger.defaultLogLevel=off", + "-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog", + } + global _tabula_vm if not _tabula_vm: _tabula_vm = TabulaVm(java_options, options.silent) - elif java_options: + elif set(java_options) - IGNORED_JAVA_OPTIONS: logger.warning("java_options is ignored until rebooting the Python process.") return _tabula_vm.call_tabula_java(options, path)