# Different round() behaviour online and desktop

**URL:** <https://discourse.psychopy.org/t/different-round-behaviour-online-and-desktop/28616>\
**Category:** Builder\
**Created:** [April 13, 2022, 2:49pm UTC](https://discourse.psychopy.org/t/different-round-behaviour-online-and-desktop/28616 "2022-04-13T14:49:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gjpstrain](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gjpstrain/32/31756_2.png) [@gjpstrain](https://discourse.psychopy.org/u/gjpstrain)\
**Post date:** [April 13, 2022, 2:49pm UTC](https://discourse.psychopy.org/t/different-round-behaviour-online-and-desktop/28616/1 "2022-04-13T14:49:29Z")

</div>

**OS** Win10  
**PsychoPy version** v2022.1.2  
**Standard Standalone?** yes

I have built an experiment in which participants are asked to adjust a slider. The value of the slider is displayed above it. To achieve this I have used a code component to define “thisPos”

thisPos = slider.getMarkerPos()

And then a text component to display the number:

$'Current rating: ’ + str(round(thisPos, 2))

This is done so that the number displayed is rounded to 2dp, instead of being a very long string. Weirdly this works completely fine online, but when trying to run it in the builder on my desktop, I get this error:

ratingText.setText('Current rating: ’ + str(round(thisPos, 2)), log=False)  
TypeError: type NoneType doesn’t define **round** method

I would much rather be able to test the experiment on the desktop, so any help in understanding why the behaviours differ would be much appreciated.

---

<div class="post-metadata">

**Author:** ![suelynnmah](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@suelynnmah](https://discourse.psychopy.org/u/suelynnmah)\
**Post date:** [April 13, 2022, 4:40pm UTC](https://discourse.psychopy.org/t/different-round-behaviour-online-and-desktop/28616/2 "2022-04-13T16:40:50Z")

</div>

Hi, this is happening because the slider doesn’t have a start value so if you set a start value, it should fix the error. Although, if you do not want a start value, you can set the text component start time to condition and in the field, use slider.rating. This means that this component only starts when there is a rating.

---

<div class="post-metadata">

**Author:** ![gjpstrain](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gjpstrain/32/31756_2.png) [@gjpstrain](https://discourse.psychopy.org/u/gjpstrain)\
**Post date:** [April 14, 2022, 9:08am UTC](https://discourse.psychopy.org/t/different-round-behaviour-online-and-desktop/28616/3 "2022-04-14T09:08:14Z")

</div>

So in my code component I have thisPos = 0 in the Begin Routine tab. Is this what you mean?

---

<div class="post-metadata">

**Author:** ![suelynnmah](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@suelynnmah](https://discourse.psychopy.org/u/suelynnmah)\
**Post date:** [April 14, 2022, 10:55am UTC](https://discourse.psychopy.org/t/different-round-behaviour-online-and-desktop/28616/4 "2022-04-14T10:55:39Z")

</div>

Hi, not really. I made a minimal demo to demonstrate what I was referring to in my previous comment.

[show\_slider\_rating.psyexp](https://discourse.psychopy.org/uploads/short-url/i6xjjxxg8ct3VoIEHEWHyMsD3ni.psyexp) (12.3 KB)

---

<div class="post-metadata">

**Author:** ![gjpstrain](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gjpstrain/32/31756_2.png) [@gjpstrain](https://discourse.psychopy.org/u/gjpstrain)\
**Post date:** [April 22, 2022, 9:52am UTC](https://discourse.psychopy.org/t/different-round-behaviour-online-and-desktop/28616/5 "2022-04-22T09:52:49Z")

</div>

Thanks! This makes sense now
