Skip to content

irissqlcli magic is not working on jupyter notebook #7

@grongierisc

Description

@grongierisc

On a jupyter notebook the magic function is not working :

image

it says :

Warning: Input is not a terminal (fd=0).

Server:  InterSystems IRIS Version 2022.3.0.589 xDBC Protocol Version 65
Version: 0.4.0

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[2], line 1
----> 1 get_ipython().run_line_magic('irissqlcli', 'iris://fhirsql:password@1.1.1.1:1972/FHIRDB')

File ~/git/iris-fhirsqlbuilder/.venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py:2369, in InteractiveShell.run_line_magic(self, magic_name, line, _stack_depth)
   2367     kwargs['local_ns'] = self.get_local_scope(stack_depth)
   2368 with self.builtin_trap:
-> 2369     result = fn(*args, **kwargs)
   2370 return result

File ~/git/iris-fhirsqlbuilder/.venv/lib/python3.9/site-packages/irissqlcli/magic.py:38, in irissqlcli_line_magic(line)
     35     conn._irissqlcli = irissqlcli
     37 try:
---> 38     irissqlcli.run_cli()
     39 except SystemExit:
     40     pass

File ~/git/iris-fhirsqlbuilder/.venv/lib/python3.9/site-packages/irissqlcli/main.py:677, in IRISSqlCli.run_cli(self)
    675 while True:
    676     try:
--> 677         text = self.prompt_app.prompt()
    678     except KeyboardInterrupt:
    679         continue

File ~/git/iris-fhirsqlbuilder/.venv/lib/python3.9/site-packages/prompt_toolkit/shortcuts/prompt.py:1034, in PromptSession.prompt(self, message, editing_mode, refresh_interval, vi_mode, lexer, completer, complete_in_thread, is_password, key_bindings, bottom_toolbar, style, color_depth, cursor, include_default_pygments_style, style_transformation, swap_light_and_dark_colors, rprompt, multiline, prompt_continuation, wrap_lines, enable_history_search, search_ignore_case, complete_while_typing, validate_while_typing, complete_style, auto_suggest, validator, clipboard, mouse_support, input_processors, placeholder, reserve_space_for_menu, enable_system_prompt, enable_suspend, enable_open_in_editor, tempfile_suffix, tempfile, default, accept_default, pre_run, set_exception_handler, handle_sigint, in_thread)
   1031     with self._dumb_prompt(self.message) as dump_app:
   1032         return dump_app.run(in_thread=in_thread, handle_sigint=handle_sigint)
-> 1034 return self.app.run(
   1035     set_exception_handler=set_exception_handler,
   1036     in_thread=in_thread,
   1037     handle_sigint=handle_sigint,
   1038 )

File ~/git/iris-fhirsqlbuilder/.venv/lib/python3.9/site-packages/prompt_toolkit/application/application.py:978, in Application.run(self, pre_run, set_exception_handler, handle_sigint, in_thread)
    975     loop = new_event_loop()
    976     set_event_loop(loop)
--> 978 return loop.run_until_complete(
    979     self.run_async(
    980         pre_run=pre_run,
    981         set_exception_handler=set_exception_handler,
    982         handle_sigint=handle_sigint,
    983     )
    984 )

File /usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py:623, in BaseEventLoop.run_until_complete(self, future)
    612 """Run until the Future is done.
    613 
    614 If the argument is a coroutine, it is wrapped in a Task.
   (...)
    620 Return the Future's result, or raise its exception.
    621 """
    622 self._check_closed()
--> 623 self._check_running()
    625 new_task = not futures.isfuture(future)
    626 future = tasks.ensure_future(future, loop=self)

File /usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py:583, in BaseEventLoop._check_running(self)
    581 def _check_running(self):
    582     if self.is_running():
--> 583         raise RuntimeError('This event loop is already running')
    584     if events._get_running_loop() is not None:
    585         raise RuntimeError(
    586             'Cannot run the event loop while another loop is running')

RuntimeError: This event loop is already running

For the more the ipython-sql dependency is missing : pip install ipython-sql==0.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions