# Warning information about “Gyroguide“

**URL:** <https://discourse.slicer.org/t/warning-information-about-gyroguide/42272>\
**Category:** Support\
**Tags:** extensions-manager\
**Created:** [March 24, 2025, 1:52am UTC](https://discourse.slicer.org/t/warning-information-about-gyroguide/42272 "2025-03-24T01:52:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![doc-xie](https://avatars.discourse-cdn.com/v4/letter/d/c77e96/32.png) [@doc-xie](https://discourse.slicer.org/u/doc-xie)\
**Post date:** [March 24, 2025, 1:52am UTC](https://discourse.slicer.org/t/warning-information-about-gyroguide/42272/1 "2025-03-24T01:52:55Z")

</div>

Hi everyone,  
In module “Gyroguide”, after the markers setting, click “calculate”, the warning information showed as below:Traceback (most recent call last):  
File “/Applications/Slicer.app/Contents/Extensions-32448/GyroGuide/lib/Slicer-5.6/qt-scripted-modules/GyroGuide.py”, line 367, in onCalculateButtonClicked  
result = PuncturePlannerCalculator(markersFiducialsNode, targetFiducialNode, entryFiducialNode)  
File “/Applications/Slicer.app/Contents/Extensions-32448/GyroGuide/lib/Slicer-5.6/qt-scripted-modules/GyroGuide.py”, line 577, in **init**  
for j in xrange(n):  
NameError: name ‘xrange’ is not defined  
What the reason about this problem and how to fix the issue?  
Best wishes,  
Xie

---

<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 24, 2025, 12:58pm UTC](https://discourse.slicer.org/t/warning-information-about-gyroguide/42272/2 "2025-03-24T12:58:45Z")

</div>

Hi @doc-xie - `xrange` was available in older Slicer versions that used Python2, but it’s not in Python3, so it should be `range` instead. There’s some background on the transition here: [Updating slicer to work with python 3](https://discourse.slicer.org/t/updating-slicer-to-work-with-python-3/4662)

---

<div class="post-metadata">

**Author:** ![doc-xie](https://avatars.discourse-cdn.com/v4/letter/d/c77e96/32.png) [@doc-xie](https://discourse.slicer.org/u/doc-xie)\
**Post date:** [March 25, 2025, 2:58am UTC](https://discourse.slicer.org/t/warning-information-about-gyroguide/42272/3 "2025-03-25T02:58:02Z")

</div>

Thanks Steve Pieper,  
I agree with you that the reason is the -xrange was not compatible with Python3. But I was confused with the transition. I want to know is there a easy way to solve the problem? The version of Python in my 3D Slicer is "3.9.10 (main, Apr 5 2024, 00:33:09) "  
Best wishes,  
Xie

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [March 25, 2025, 5:20am UTC](https://discourse.slicer.org/t/warning-information-about-gyroguide/42272/4 "2025-03-25T05:20:15Z")

</div>

Hi Xie, it is definitely a developer task to make the code python 3 compatible. The easiest way for a developer to do this would be to utilize the pre-commit framework with a hook to run pyupgrade. That will then automatically apply fixes to upgrade the code syntax to a specific python version such as 3.9 as used by latest Slicer.

See for example this specification of pyupgrade in a pre-commit configuration file.

> <https://github.com/Slicer/Slicer/blob/6527a2660220a3beae41ad0f812e8e7cc25b4284/.pre-commit-config.yaml#L26>

Note that the GyroGuide extension hasn’t significantly been updated since 2015 which is a very long time. Do you know Luping Fang who appears to be the main developer of that extension?

> **[Commits · lpfang/GyroGuide](https://github.com/lpfang/GyroGuide/commits/master/)**
>
> An python extension of 3D Slicer helps surgeons implement puncture orientation. - Commits · lpfang/GyroGuide

---

<div class="post-metadata">

**Author:** ![doc-xie](https://avatars.discourse-cdn.com/v4/letter/d/c77e96/32.png) [@doc-xie](https://discourse.slicer.org/u/doc-xie)\
**Post date:** [March 27, 2025, 2:49am UTC](https://discourse.slicer.org/t/warning-information-about-gyroguide/42272/5 "2025-03-27T02:49:21Z")

</div>

Hi James Butler，  
I do not know LP Fang, but I will try to contact with him about this issue. Hope this problem can be solved in no time.  
Best wishes,  
Xie
