# Slicer does not respond while working on a code and after finishing the loop prints everything

**URL:** <https://discourse.slicer.org/t/slicer-does-not-respond-while-working-on-a-code-and-after-finishing-the-loop-prints-everything/22277>\
**Category:** Development\
**Tags:** dicom\
**Created:** [March 3, 2022, 8:50am UTC](https://discourse.slicer.org/t/slicer-does-not-respond-while-working-on-a-code-and-after-finishing-the-loop-prints-everything/22277 "2022-03-03T08:50:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![S\_Arbabi](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@S\_Arbabi](https://discourse.slicer.org/u/S_Arbabi)\
**Post date:** [March 3, 2022, 8:50am UTC](https://discourse.slicer.org/t/slicer-does-not-respond-while-working-on-a-code-and-after-finishing-the-loop-prints-everything/22277/1 "2022-03-03T08:50:46Z")

</div>

Hello all,

I implemented a function that reads the DICOM data from a source on web (by looping over the API’s of the web service) and writes them on disk if needed. In the code I wrote "print"s in each iteration of loop to know where the current state is and which image it is fetching.  
But once running the function, Slicer does not respond and print nothing (but works in the background with fetching folders to disk) and once everything is done it prints everything it was about to print from beginning.

I was wondering what is the issue, and can I do a workaround for that?

Best wishes,  
Saeed

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [March 3, 2022, 9:10am UTC](https://discourse.slicer.org/t/slicer-does-not-respond-while-working-on-a-code-and-after-finishing-the-loop-prints-everything/22277/2 "2022-03-03T09:10:59Z")

</div>

The issue is that the GUI does not update while this is being done. If you do `slicer.app.processEvents()` calls between the print statements, they will appear.
