0

I am running a Python script in Jupyter Notebook and a library I am using (PyNN), produces a lot of stderr output that slows down the code and fills up the memory. I have tried using %%capture at the beginning of the cell but nothing has changed, and the output remains the same.

I am posting a snap of the output.enter image description here

Any tips are appreciated. Thanks

costisst
  • 251
  • 1
  • 6
  • 20

1 Answers1

0

If the issue is with printing, you can redirect the stream with contextlib:

import contextlib
import os

devnull = open(os.devnull, 'w')
contextlib.redirect_stderr(devnull)
Maximilian Burszley
  • 15,132
  • 3
  • 27
  • 49
  • I am having for than 1 scripts in my code, which implement different classes. I tried this code in the main script, which is the only one using the PyNN library, but it didn't work. I also tried adding it in every script and it didn't work either – costisst Aug 23 '20 at 13:33