Skip to content

Commit

Permalink
Try different in_interactive_session rule
Browse files Browse the repository at this point in the history
Check for interactive sessions using sys.ps1 rather than
__main__.__file__, as the latter was not working on github CI
  • Loading branch information
pvandyken committed Dec 12, 2023
1 parent 5769f09 commit 500d1d4
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions snakebids/io/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from __future__ import annotations

import functools as ft
import sys
from shutil import get_terminal_size


Expand Down Expand Up @@ -97,11 +98,7 @@ def in_interactive_session() -> bool:
"""

def check_main() -> bool:
try:
import __main__ as main
except ModuleNotFoundError:
return False
return not hasattr(main, "__file__")
return hasattr(sys, "ps1")

try:
# error: Name '__IPYTHON__' is not defined
Expand Down

0 comments on commit 500d1d4

Please sign in to comment.