Skip to content

Commit

Permalink
fix module not importing when in interpreted session
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubobubobubobubo committed Nov 7, 2022
1 parent d1752cf commit dd6bb7c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fishery/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def callback():
else:
self.showtraceback()

from sys import argv
print(f"File name: {argv[0]}")

class REPLThread(threading.Thread):
def run(self):
Expand Down
5 changes: 5 additions & 0 deletions sardine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ def __exit__(self, exc_type, exc_val, exc_tb):
sleep(self.duration)


from sys import argv
hook_path = argv[0]
if "__main__.py" in hook_path:
os.environ['SARDINE_INIT_SESSION'] = 'YES'

if (
os.getenv("SARDINE_INIT_SESSION") is not None
and os.getenv("SARDINE_INIT_SESSION") == "YES"
Expand Down

0 comments on commit dd6bb7c

Please sign in to comment.