# Python script crashes when running w/o GUI due to smoothing effect

**URL:** <https://discourse.slicer.org/t/python-script-crashes-when-running-w-o-gui-due-to-smoothing-effect/28118>\
**Category:** Support\
**Created:** [March 1, 2023, 3:13pm UTC](https://discourse.slicer.org/t/python-script-crashes-when-running-w-o-gui-due-to-smoothing-effect/28118 "2023-03-01T15:13:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gholl](https://avatars.discourse-cdn.com/v4/letter/g/c2a13f/32.png) [@Gholl](https://discourse.slicer.org/u/Gholl)\
**Post date:** [March 1, 2023, 3:13pm UTC](https://discourse.slicer.org/t/python-script-crashes-when-running-w-o-gui-due-to-smoothing-effect/28118/1 "2023-03-01T15:13:33Z")

</div>

I try to run a python script via the command ./Slicer --no-splash --no-main-window --python-script ‘customScript.py’.

It crashes when executing the following line: `segmentEditorWidget.setActiveEffectByName("Smoothing")`, however, it works when I remove the flag --no-main-window and also when the same code is run via a Jupyter Notebook.

Is there any way to apply smoothing effect w/o a GUI?

Slicer version: 5.2.2

Thanks!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 1, 2023, 4:02pm UTC](https://discourse.slicer.org/t/python-script-crashes-when-running-w-o-gui-due-to-smoothing-effect/28118/2 "2023-03-01T16:02:03Z")

</div>

Presence of a main window is required for most application features. Having a main window is generally useful - it allows quick direc visualization, often used side-by-side with the notebook - but if you don’t want to see it then you can minimize the main window right after the application has started.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [March 1, 2023, 6:50pm UTC](https://discourse.slicer.org/t/python-script-crashes-when-running-w-o-gui-due-to-smoothing-effect/28118/3 "2023-03-01T18:50:00Z")

</div>

If you really don’t want a window to pop up you could also run Slicer in a docker, although that’s a lot of installation overhead compared to just minimizing the window.

---

<div class="post-metadata">

**Author:** ![Gholl](https://avatars.discourse-cdn.com/v4/letter/g/c2a13f/32.png) [@Gholl](https://discourse.slicer.org/u/Gholl)\
**Post date:** [March 1, 2023, 7:42pm UTC](https://discourse.slicer.org/t/python-script-crashes-when-running-w-o-gui-due-to-smoothing-effect/28118/4 "2023-03-01T19:42:56Z")

</div>

Ok, then I know. Thanks!
