Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 02:30
    csaroff commented #1582
  • May 18 20:42
    danking commented #729
  • May 18 20:40
    SnarkBoojum commented #729
  • May 18 06:01
    tonyroberts commented #724
  • May 18 05:58
    tonyroberts reopened #724
  • May 18 05:58
    tonyroberts closed #724
  • May 17 15:14
    oliver-sanders commented #724
  • May 17 15:14
    oliver-sanders commented #724
  • May 16 22:09
    pre-commit-ci[bot] opened #730
  • May 16 22:09

    pre-commit-ci[bot] on pre-commit-ci-update-config

    [pre-commit.ci] pre-commit auto… (compare)

  • May 16 22:01
    psychemedia commented #13346
  • May 16 22:00
    psychemedia commented #13346
  • May 16 13:48
    danking opened #729
  • May 16 13:38
    hroncok commented #727
  • May 16 13:37
    blink1073 commented #727
  • May 16 13:34
    hroncok commented #727
  • May 16 13:13

    blink1073 on main

    back to dev version (compare)

  • May 16 13:12

    blink1073 on 5.2.1.post0

    (compare)

  • May 16 13:12

    blink1073 on main

    Release 5.2.1.post0 (compare)

  • May 16 12:57
    blink1073 commented #727
Min RK
@minrk
@blastoporeus_twitter try %run $target to get variable expansion
1 reply
nbuntrust
@nbuntrust
Is there any way to gain access to the SingleUserNotebookApp data from an ipython extension?
nbuntrust
@nbuntrust
Right now I'm parsing syslog data on the fly to get the IP of the connected user, but of course if SingleUserNotebookApp is writing it into a log, it knows it somewhere that I would think I could access more efficiently... :-)
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.