Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 02:28
    krassowski edited #13852
  • 02:27
    krassowski labeled #13854
  • 02:27
    krassowski edited #13854
  • 02:27
    krassowski ready_for_review #13854
  • 02:26
    krassowski edited #13854
  • 02:25
    krassowski edited #13854
  • 02:21
    krassowski synchronize #13854
  • 02:15
    krassowski synchronize #13854
  • 02:08
    krassowski synchronize #13854
  • 01:56
    krassowski opened #13854
  • 01:53
    krassowski commented #13853
  • 01:50
    krassowski commented #13853
  • 01:31
    krassowski closed #13840
  • 01:31
    krassowski commented #13840
  • 01:29
    krassowski labeled #13830
  • 01:27
    krassowski closed #6790
  • 01:27
    krassowski commented #6790
  • 01:25
    krassowski labeled #13853
  • 01:24
    krassowski labeled #13828
  • 01:24
    krassowski commented #13828
Nicholas Bollweg
@bollwyvl
they are in different processes. you can talk to the API like any other client, however.
nbuntrust
@nbuntrust
This API is documented somewhere? I guess that's what I'm trying to find
siddharth99
@siddharth99
Hi, I am running into an error with cython code and the jupyter kernel ends up restarting itself.. I don't see where the actual error happens, don't see a core file and not sure how to debug further
[I 13:59:36.224 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports kernel b4f40812-cf7d-4f97-925b-84780f946bc9 restarted
anyone has any suggestions?
1 reply
pritimanbala
@pritimanbala
hii
there
there is a problem that i am running code in the for loop of python and now I cant configure it out that how can I run my loop in the cmd of my pc
wraptile
@wraptile:matrix.org
[m]

Hello, can I embed ipython in an async program? can't seem to find any docs on it. I've tried:

    import nest_asyncio
    nest_asyncio.apply()
    IPython.embed(using='asyncio')

with no luck 😐️

Thomas A Caswell
@tacaswell
On a very new version of everything (CPython, traitlets, and IPython) I'm seeing AttributeError: 'Namespace' object has no attribute '_flags' when starting with ipython --simple-prompt. Has anyone else seen this or have hints of where to start looking?
`
Thomas A Caswell
@tacaswell
Looks like this is a change it CPython :/
Min RK
@minrk
@tacaswell 3.10 or 3.9?
Min RK
@minrk
Ah, I see it. Merged, thanks!
Thomas A Caswell
@tacaswell
Thanks @minrk !
Cassiel-girl
@Cassiel-girl
When I enter ipython, I enter python code and the result is returned. Which function can realize that the input parameter is Python code and the result of function execution is similar to the result of ipython after executing that python code?
Cassiel-girl
@Cassiel-girl
An ipython backend is running on one machine A. This backend receives commands from a user on another machine B, sends them to A for execution, and then returns the results to B. The program running on the other machine B is a pyqt5 GUI that can type strings, but machine B cannot install anything ipython related. What programming interface should the program on machine A call to implement? Or an example of the relevant code.
Min RK
@minrk
That's potentically a big task, but the main core function for evaluating code is exec. What 'results' might be is tricky for exec.
IPython's implementation is mostly here but it has lots of handling of different async situations that you probably don't need. Other things to consider include a persistent namespace or not, etc.
Jerry Johns
@mrjerryjohns

Hello! I'm seeing an issue with my IPython setup on Mac, where attempting to use await with an async command results in the following error:

    648 
    649         if self._local._loop is None:
--> 650             raise RuntimeError('There is no current event loop in thread %r.'
    651                                % threading.current_thread().name)
    652 

RuntimeError: There is no current event loop in thread 'MainThread'.

I've traced it to the fact that the following call always errors out:

import asyncio
asyncio.get_event_loop()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-6-6908e23590ee> in <module>
----> 1 asyncio.get_event_loop()

/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/events.py in get_event_loop(self)
    648 
    649         if self._local._loop is None:
--> 650             raise RuntimeError('There is no current event loop in thread %r.'
    651                                % threading.current_thread().name)
    652 

RuntimeError: There is no current event loop in thread 'MainThread'.
Extensive search of stack-overflow didn't yield any answers unfortunately :(
Min RK
@minrk
@mrjerryjohns what's your IPython version? I wouldn't expect that on recent IPython.
Jerry Johns
@mrjerryjohns

Python 3.9.7, IPython 7.30.0.

Reproducible test case:

Python 3.9.7 (default, Oct 13 2021, 06:45:31) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.30.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: async def ping():
   ...:     pass
   ...: 

In [2]: 

In [2]: await ping()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/usr/local/lib/python3.9/site-packages/IPython/core/async_helpers.py in __call__(self, coro)
     26         import asyncio
     27 
---> 28         return asyncio.get_event_loop().run_until_complete(coro)
     29 
     30     def __str__(self):

/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/events.py in get_event_loop(self)
    644 
    645         if self._local._loop is None:
--> 646             raise RuntimeError('There is no current event loop in thread %r.'
    647                                % threading.current_thread().name)
    648 

RuntimeError: There is no current event loop in thread 'MainThread'.

In [2]:
9 replies
Michał Krassowski
@krassowski
What is IPython display equivalent of print(something, file=sys.stderr)? Like tracebacks for extensions get printed out on red background, I would have thought there is a 1-1 utility for displaying rich-formatted warnings/errors other than exceptions - is there one?
Min RK
@minrk
There isn't a stderr-equivalent for display. Just one display channel.
It could be reasonable to define a metadata field for this use case
Maxime Liquet
@maximlt
Hi all! Running publish_display_data(data={'application/javascript': 'console.log(1)'}) in a notebook cell creates an output with an empty div that is displayed (height of 12.23px). Is there a way to hide such output from IPython's API?
5 replies
Cassiel-girl
@Cassiel-girl
how to know the data layout of data type in memory?
aplund
@aplund:matrix.org
[m]
How do I enter mutiple expressions at once? I've tried shift-enter and ctrl-o enter, and neither work for me. I'm using the 'vi' editing_mode.
dxaw2004
@dxaw2004
is Ipython doesn't support
warnings.simplefilter('once', RuntimeWarning)

import warnings
warnings.simplefilter('once', RuntimeWarning)
def x():
warnings.warn('xx', RuntimeWarning)
x()
C:\Program Files (x86)\Python37-32\Scripts\ipython:2: RuntimeWarning: xx
x()
C:\Program Files (x86)\Python37-32\Scripts\ipython:2: RuntimeWarning: xx

I expect the warning just show once, i try the same code with python, it work as expect. what's wrong here?

Charles Ojemen
@ojemen_charles_twitter
Hhhsms
Ganomee
@Ganomee
Hello, does anyone of you know of a way, to store the output of the %store command into a variable inside a notebook? While %store produces a printed output, I cannot seem to get its output into a list form [a,b] if the store contains variables a and b.
1 reply