# balenaFin ttn-gateway-balenafin (balena-io-playground) error

**URL:** <https://forums.balena.io/t/balenafin-ttn-gateway-balenafin-balena-io-playground-error/14488>\
**Category:** Project help\
**Created:** [June 10, 2019, 10:15am UTC](https://forums.balena.io/t/balenafin-ttn-gateway-balenafin-balena-io-playground-error/14488 "2019-06-10T10:15:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![g\_raphael\_kruetli](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/g_raphael_kruetli/32/2066_2.png) [@g\_raphael\_kruetli](https://forums.balena.io/u/g_raphael_kruetli)\
**Post date:** [June 10, 2019, 10:15am UTC](https://forums.balena.io/t/balenafin-ttn-gateway-balenafin-balena-io-playground-error/14488/1 "2019-06-10T10:15:51Z")

</div>

Hi

Got my new balenaFin, a RAK 811 (spi/usb), an Adafruit Ultimate GPS, but everything together, followed…

> **[Build a TTN LoRa Gateway with balenaFin and balenaCloud](https://www.balena.io/blog/build-a-ttn-lora-gateway-with-balenafin-and-balenacloud/)**
>
> We’ve taken a look at deploying a gateway for TTN on our blog in the past, but this time we’re going to look at setting one up using the new balenaFin with plug and play hardware! We’ll use the on-board mPCIe slot to interface with a RAK

> **[balena-io-playground/ttn-gateway-balenafin](https://github.com/balena-io-playground/ttn-gateway-balenafin)**
>
> Using balenaFin with a RAK833 mPCIe LoRa concentrator module - balena-io-playground/ttn-gateway-balenafin

…but stuck with the following error:

10.06.19 12:02:28 (+0200) main Traceback (most recent call last):  
10.06.19 12:02:28 (+0200) main File “/opt/ttn-gateway/run.py”, line 10, in   
10.06.19 12:02:28 (+0200) main import urllib.request as urllib2  
10.06.19 12:02:28 (+0200) main ImportError: No module named request  
10.06.19 12:02:29 (+0200) Service exited ‘main sha256:0ddfe95d7f3bb7a4f6ba53f78eb4[…]’

Any hints how handle this python error?

Thanks!

---

<div class="post-metadata">

**Author:** ![g\_raphael\_kruetli](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/g_raphael_kruetli/32/2066_2.png) [@g\_raphael\_kruetli](https://forums.balena.io/u/g_raphael_kruetli)\
**Post date:** [June 10, 2019, 10:55am UTC](https://forums.balena.io/t/balenafin-ttn-gateway-balenafin-balena-io-playground-error/14488/4 "2019-06-10T10:55:16Z")

</div>

…fixed:

Change line 10 in file [https://github.com/balena-io-playground/ttn-gateway-balenafin/blob/master/run.py](https://github.com/balena-io-playground/ttn-gateway-balenafin/blob/master/run.py)

from

- import urllib.request as urllib2

to

- import urllib2

Concentrator started, connected to TTN, GPS is working. Great!

Cheers

---

<div class="post-metadata">

**Author:** ![dansku](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/dansku/32/1183_2.png) [@dansku](https://forums.balena.io/u/dansku)\
**Post date:** [June 10, 2019, 11:17am UTC](https://forums.balena.io/t/balenafin-ttn-gateway-balenafin-balena-io-playground-error/14488/5 "2019-06-10T11:17:52Z")

</div>

Awesome @g_raphael_kruetli, I am glad everything is working!

Keep us posted on the progress, and share pictures if possible 🙂

Rock on!

---

<div class="post-metadata">

**Author:** ![g\_raphael\_kruetli](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/g_raphael_kruetli/32/2066_2.png) [@g\_raphael\_kruetli](https://forums.balena.io/u/g_raphael_kruetli)\
**Post date:** [June 11, 2019, 11:53am UTC](https://forums.balena.io/t/balenafin-ttn-gateway-balenafin-balena-io-playground-error/14488/7 "2019-06-11T11:53:02Z")

</div>

The “problem” might be, that in Python 3 urlib2 is spitted into different modules (eg. request) but the used containter/baseimage ([https://github.com/balena-io-playground/ttn-gateway-balenafin/blob/master/Dockerfile](https://github.com/balena-io-playground/ttn-gateway-balenafin/blob/master/Dockerfile)) in this project is…

FROM balenalib/raspberrypi3:build AS build  
FROM balenalib/raspberrypi3-python

…Python 2 if I’m not mistaken (the above FROM derective defaults do Python 2 according to [https://www.balena.io/docs/reference/base-images/base-images/](https://www.balena.io/docs/reference/base-images/base-images/)).

Either change the python script (running under Python 2, that means, use “import urlib2”) or change der Docker file “FROM” derective to reflect a resent Python 3 version (“FROM balenalib/raspberrypi3-python:3-stretch-run” or something like this. Have not tried it out yet…

All in all: nice project, nice platform - and yes, its new to me, so be patient with me 😉

---

<div class="post-metadata">

**Author:** ![chrisys](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/chrisys/32/1731_2.png) [@chrisys](https://forums.balena.io/u/chrisys)\
**Post date:** [June 12, 2019, 6:37pm UTC](https://forums.balena.io/t/balenafin-ttn-gateway-balenafin-balena-io-playground-error/14488/10 "2019-06-12T18:37:23Z")

</div>

@g_raphael_kruetli thanks for letting us know about this issue. I have just pushed your suggested change to the urllib import to the repo!
