# Auto hat mini example syntax error

**URL:** <https://forums.pimoroni.com/t/auto-hat-mini-example-syntax-error/14517>\
**Category:** Support\
**Created:** [July 15, 2020, 10:36pm UTC](https://forums.pimoroni.com/t/auto-hat-mini-example-syntax-error/14517 "2020-07-15T22:36:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![josulliv](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@josulliv](https://forums.pimoroni.com/u/josulliv)\
**Post date:** [July 15, 2020, 10:36pm UTC](https://forums.pimoroni.com/t/auto-hat-mini-example-syntax-error/14517/1 "2020-07-15T22:36:36Z")

</div>

Hi,  
I’m having trouble running the analog example for the Automation hat mini:

pi@rpi\_garage:~/Pimoroni/automationhat/examples/hat-mini $ python analog.py  
File “analog.py”, line 71  
draw.text((text\_x, text\_y + offset), f"{reading:.2f}", font=font, fill=colour)  
^  
SyntaxError: invalid syntax

Any suggestions?  
Thanks.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 16, 2020, 11:18am UTC](https://forums.pimoroni.com/t/auto-hat-mini-example-syntax-error/14517/2 "2020-07-16T11:18:10Z")

</div>

Are you running if from command line or from an IDE?  
If from an IDE, does it highlight a specific part of that line?  
I usually test run my python files from Idle3, it highlights the specific spot it doesn’t like.

---

<div class="post-metadata">

**Author:** ![josulliv](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@josulliv](https://forums.pimoroni.com/u/josulliv)\
**Post date:** [July 16, 2020, 6:15pm UTC](https://forums.pimoroni.com/t/auto-hat-mini-example-syntax-error/14517/3 "2020-07-16T18:15:00Z")

</div>

I was running from the command line. I ran it from Idle3 and it puts ther cursor right at the Z in the line below (the Z isn’t in the code, just put here for illustration purposes):  
draw.text((text\_x, text\_y + offset), f"{reading:.2f}"Z, font=font, fill=colour)

New to python so it’s probably an obvious issue!

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 16, 2020, 7:18pm UTC](https://forums.pimoroni.com/t/auto-hat-mini-example-syntax-error/14517/4 "2020-07-16T19:18:46Z")

</div>

It’s not obvious to me? I’m no expert, but I’m not a noob either.  
The examples should just work?

---

<div class="post-metadata">

**Author:** ![josulliv](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@josulliv](https://forums.pimoroni.com/u/josulliv)\
**Post date:** [July 16, 2020, 10:35pm UTC](https://forums.pimoroni.com/t/auto-hat-mini-example-syntax-error/14517/5 "2020-07-16T22:35:58Z")

</div>

I see what the problem is. The code uses an f-string, which requires Python 3.6+. I’m running an old OS with 3.5. Time to upgrade.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 16, 2020, 10:49pm UTC](https://forums.pimoroni.com/t/auto-hat-mini-example-syntax-error/14517/6 "2020-07-16T22:49:43Z")

</div>

Wow, nice sleuthing, I doubt I would have figured that out.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 16, 2020, 11:02pm UTC](https://forums.pimoroni.com/t/auto-hat-mini-example-syntax-error/14517/7 "2020-07-16T23:02:39Z")

</div>

You may be able to just do a dist-upgrade, and not have to start over. I am a Linux noob for sure though.
