While trying to troubleshoot my Winlink packet connections with my home-brewed, slightly modified Arduino-TNC, I found that mobilinkd has made a GUI tool in python that allows you to adjust the settings. The only problem was following the instructions to install it!

First, you can download this great tool here:

https://github.com/mobilinkd/tnc1-python-config

I used the traditional git clone method.

$ git clone https://github.com/mobilinkd/tnc1-python-config.git
$ cd tnc1-python-config

Once inside, I attempted to follow the instructions:

This was built/tested with Python 3.6, pyserial-3.1.1 and pygobject-3.28.3

python3-3.6.6-1.fc28.x86_64 python3-pyserial-3.1.1-6.fc28.noarch python3-gobject-3.28.3-1.fc28.x86_64

./setup.py bdist_rpm

Will build an RPM that can be installed.

Of course, I don’t need an rpm, but the script has options for build, which just builds the executable.

But, it gave me these weird errors:

./setup.py build
/usr/bin/env: ‘python2.7\r’: No such file or directory

Turns out, after some research, that the file has the carriage return in it, and you need to specify that it is being used on Linux, so don’t take the carriage return literally as a backslash r. Fortunately, this guy made a write up on how to do that with vim (don’t try with vi, didn’t work for me, had to use vim).

https://stackoverflow.com/questions/19425857/env-python-r-no-such-file-or-directory

With that fixed, I went back to trying the build.

Traceback (most recent call last):
  File "./setup.py", line 10, in <module>
    from setuptools import setup
ImportError: No module named setuptools

Okay, so I install setup tools….

$ sudo apt install python-setuptools

Alright, made it through that hurdle.

$ ./setup.py build
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'executables'
  warnings.warn(msg)
running build
running build_py
creating build/lib.linux-x86_64-2.7
copying Avr109.py -> build/lib.linux-x86_64-2.7
copying BootLoader.py -> build/lib.linux-x86_64-2.7
copying IntelHexRecord.py -> build/lib.linux-x86_64-2.7
copying TncModel.py -> build/lib.linux-x86_64-2.7
running build_scripts
creating build/scripts-2.7
copying and adjusting TncConfigApp.py -> build/scripts-2.7
changing mode of build/scripts-2.7/TncConfigApp.py from 664 to 775

And when I tried to run it:

$ cd build/scripts-2.7/
$ python2.7 ./TncConfigApp.py 
Traceback (most recent call last):
  File "./TncConfigApp.py", line 20, in <module>
    import serial.tools.list_ports
ImportError: No module named serial.tools.list_ports

Uhhhg! But I didn’t want to build with python 2.7, I wanted to build with python 3. So, a little research revealed that I need to specify which python while building:

$ python3 ./setup.py build
Warning: 'platforms' should be a list, got type 'tuple'
Warning: 'keywords' should be a list, got type 'tuple'
/usr/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'executables'
  warnings.warn(msg)
running build
running build_py
creating build/lib
copying Avr109.py -> build/lib
copying BootLoader.py -> build/lib
copying IntelHexRecord.py -> build/lib
copying TncModel.py -> build/lib
running build_scripts
creating build/scripts-3.8
copying and adjusting TncConfigApp.py -> build/scripts-3.8
changing mode of build/scripts-3.8/TncConfigApp.py from 664 to 775

Great! Now let’s try that one….

$ cd build/scripts-3.8/
$ python3 ./TncConfigApp.py 
Traceback (most recent call last):
  File "./TncConfigApp.py", line 22, in <module>
    from TncModel import TncModel
ModuleNotFoundError: No module named 'TncModel'

Are you kidding me!

So then I downloaded the prebuilt RPM release and used alien to convert it to a deb and tried that, but it didn’t work either.

Finally, after more digging, I found this issue post where they tell you what you need to do:

https://github.com/mobilinkd/tnc1-python-config/issues/2#issuecomment-1405453827

And what you need to do is: don’t build it, just run the source code with python!

~/installed/tnc1-python-config$ python3 ./TncConfigApp.py

And then it worked! How frustrating to do all that work, spend about an hour trying everything to figure it out, only to find out that all I had to do was NOT FOLLOW THE INSTRUCTIONS THAT CAME WITH THE SOURCE CODE, and run the source code with python3 directly!

Well, at least after all that, it did work, and it works really well! I hooked right up to my Arduino-TNC, it recognized it immediately, and I could adjust the settings!

Linux – keep it simple.

Leave a Reply

Your email address will not be published. Required fields are marked *