# Qt warning message when I use python console

**URL:** <https://discourse.slicer.org/t/qt-warning-message-when-i-use-python-console/33865>\
**Category:** Support\
**Created:** [January 19, 2024, 7:28am UTC](https://discourse.slicer.org/t/qt-warning-message-when-i-use-python-console/33865 "2024-01-19T07:28:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![park](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/park/32/5717_2.png) [@park](https://discourse.slicer.org/u/park)\
**Post date:** [January 19, 2024, 7:28am UTC](https://discourse.slicer.org/t/qt-warning-message-when-i-use-python-console/33865/1 "2024-01-19T07:28:23Z")

</div>

Hi all

I built Slicer 5.7 as a debug version and loaded a script extension modules using the extension wizard. Since then, I have been consistently getting the following warning messages. Due to this I cannot use the Python console.

`"Using QCharRef with an index pointing outside the valid range of a QString. The corresponding behavior is deprecated, and will be changed in a future version of Qt."`

These warning messages only appear in the build version and not in the Slicer binary. Any idea what might be causing this?

![캡처](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/8/88362e7af293c801d91743f95a65c935f068fe5e.png)

---

<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:** [January 19, 2024, 1:44pm UTC](https://discourse.slicer.org/t/qt-warning-message-when-i-use-python-console/33865/2 "2024-01-19T13:44:57Z")

</div>

I’ve never seen that particular message. Since you built from source you should be able to set a breakpoint where the warning is printed and inspect the stack trace to see if this comes from specific c++ code.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [January 20, 2024, 11:04am UTC](https://discourse.slicer.org/t/qt-warning-message-when-i-use-python-console/33865/3 "2024-01-20T11:04:06Z")

</div>

Warning seems to reported by code in `QByteArray`… See [qtbase/src/corelib/text/qbytearray.cpp at v5.15.2 · qt/qtbase · GitHub](https://github.com/qt/qtbase/blob/v5.15.2/src/corelib/text/qbytearray.cpp#L5134-L5142)

@park Would it be possible to share the exact steps leading to these warning messages ? Does it happen without the generated script extension loaded ?

---

<div class="post-metadata">

**Author:** ![park](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/park/32/5717_2.png) [@park](https://discourse.slicer.org/u/park)\
**Post date:** [January 22, 2024, 2:15am UTC](https://discourse.slicer.org/t/qt-warning-message-when-i-use-python-console/33865/4 "2024-01-22T02:15:00Z")

</div>

Ironically, this warning message appeared because of “Grammarly”. It seems that Grammarly’s spelling check feature keeps activating the python interactor.

Thank you for your consideration !

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [January 22, 2024, 6:16pm UTC](https://discourse.slicer.org/t/qt-warning-message-when-i-use-python-console/33865/5 "2024-01-22T18:16:58Z")

</div>

This seems consistent with these Grammarly related comments\[1\] I found:

> > Is the grammarly desktop app interacting with browser elements without using the extension? (IIRC the grammarly app uses some accessibility privileges to inject into textareas across all apps)
> 
> It seems like that must be the case. If we have the details right about desktop app only (which seemed pretty clear).

I am wondering if there is way to “hint” Grammarly and avoid this.

What about having someone from our community with a paid account reach out and ask the Grammarly support team ?

* * *

1. [The weirdest bug I've seen yet | Hacker News](https://news.ycombinator.com/item?id=38477100)
