Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
pelinski committed Jan 31, 2025
2 parents e58c7e4 + b97437c commit 07989fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pybela/Logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ def __init__(self, ip="192.168.7.2", port=5555, data_add="gui_data", control_add

# -- logging methods --

def start_logging(self, variables=[], transfer=True, logging_dir="./"):
def start_logging(self, variables=[], transfer=False, logging_dir="./"):
""" Starts logging session. The session can be ended by calling stop_logging().
Args:
variables (list of str, optional): List of variables to be logged. If no variables are passed, all variables in the watcher are logged. Defaults to [].
transfer (bool, optional): If True, the logged files will be transferred automatically during the logging session. Defaults to True.
transfer (bool, optional): If True, the logged files will be transferred automatically during the logging session. Defaults to False. #FIXME currently broken
Returns:
list of str: List of local paths to the logged files.
Expand Down
10 changes: 8 additions & 2 deletions pybela/Watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ def __init__(self, ip="192.168.7.2", port=5555, data_add="gui_data", control_add
self._pybela_ws_register = _pybela_ws_register

# if running in jupyter notebook, enable nest_asyncio
is_running_on_jupyter_notebook = False
try:
get_ipython().__class__.__name__
is_running_on_jupyter_notebook = True
nest_asyncio.apply()
print("Running in Jupyter notebook. Enabling nest_asyncio.")
except NameError:
Expand All @@ -58,8 +60,12 @@ def __init__(self, ip="192.168.7.2", port=5555, data_add="gui_data", control_add
# background event loop
# If no loop exists, create a new one
if self._pybela_ws_register["event-loop"] is None:
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)

if is_running_on_jupyter_notebook:
self.loop = asyncio.get_event_loop()
else:
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)
self._pybela_ws_register["event-loop"] = self.loop
else: # if loop exists, use the existing one
self.loop = self._pybela_ws_register["event-loop"]
Expand Down

0 comments on commit 07989fc

Please sign in to comment.