Skip to content

Commit

Permalink
Merge pull request #1 from immunomind/issue-976
Browse files Browse the repository at this point in the history
Fix rpy2#976 by configuring interactive mode through environment variable
  • Loading branch information
djbios committed Jan 17, 2023
2 parents 77dac44 + 223e2ae commit 0d4443f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc/rinterface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ can also be triggered indirectly, as some on the R functions will behave
differently when run interactively compared to when run in the so-called
*BATCH mode*.

Interactive mode could be disabled by setting environment variable
`R_INTERACTIVE_MODE` to `False`.

.. note::

However, interactive use may mean the ability to periodically check
Expand Down
4 changes: 3 additions & 1 deletion rpy2/rinterface_lib/embedded.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,12 @@ def _setcallback(rlib, rlib_symbol: str,

# TODO: can init_once() be used here ?
def _initr(
interactive: bool = True,
interactive: bool = None,
_want_setcallbacks: bool = True,
_c_stack_limit: int = _DEFAULT_C_STACK_LIMIT
) -> typing.Optional[int]:
if interactive is None:
interactive = os.environ.get('R_INTERACTIVE_MODE', 'True').lower() in ['true', '1', 't']

rlib = openrlib.rlib
ffi_proxy = openrlib.ffi_proxy
Expand Down

0 comments on commit 0d4443f

Please sign in to comment.