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

Hi

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

…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!

…fixed:

Change line 10 in file 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

1 Like

Awesome @g_raphael_kruetli, I am glad everything is working!

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

Rock on!

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) 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/).

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 :wink:

@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!