ham-radio-software / D-Rats

D-Rats program for D-Star Ham Radios
https://iz2lxi.jimdofree.com/
Other
41 stars 12 forks source link

Error getting D-Rats to first install - GUI Exception #249

Closed KP4AJ closed 9 months ago

KP4AJ commented 10 months ago

Hi: Being trying since last night. Get this: 09/24/2023 11:35:47:INFO:D-Rats:main: re-config option found -- Reconfigure D-rats 09/24/2023 11:35:47:INFO:D-Rats:main: args.config = /root/.d-rats-ev 09/24/2023 11:35:48:INFO:DratsConfig:File /root/.d-rats-ev/d-rats.config 09/24/2023 11:35:48:INFO:DratsConfig:/root/D-RATS Shared 09/24/2023 11:35:48:INFO:MainApp:_refresh_lang: Loading locale `en' 09/24/2023 11:35:48:INFO:MainApp:_refresh_lang: Locale dir is: /home/D-Rats/locale 09/24/2023 11:35:48:ERROR:MainApp:_refresh_lang: Messages catalog file missing for en. Need to use 'msgfmt tool to generate. 09/24/2023 11:35:48:INFO:MainApp:D-RATS v0.4.1.dev0 starting at Sun Sep 24 11:35:48 2023 on Platform UnixPlatform: configuration: /root/.d-rats-ev system_data: /home/D-Rats OS version: Linux - Ubuntu 22.04.3 LTS 09/24/2023 11:35:50:INFO:D-Rats:---- GUI Exception ---- %s ---- End ---- Stack (most recent call last): File "/home/D-Rats/d-rats.py", line 94, in handle_exception MODULE_LOGGER.info("---- GUI Exception ----\n%s\n---- End ----\n",

Probably a missing library but no idea. Will appreciate any pointer. Calling D-Rats:

sudo /usr/bin/python3 /home/D-Rats/d-rats.py

.d-rats-ev shows only a maps directory but no config.

Thanks.

Edfel KP4AJ

wb8tyw commented 10 months ago

The Linux install is similar to what is done on Microsoft Windows after Msys2, a Linux emulation product is installed.

Installation on Microsoft Windows Which states if you install from the git repository that the message catalog needs to be manually built and shows a simple script to rebuild it.

The README.md file in Master also specifies that the message catalog must be built, and references the WIKI Translating-D-Rats-in-your-language for a more complex way of creating the message catalog that the simple script that was developed since that Wiki page was written as part of creating python packaging.

The binary message catalog is intentionally not installed in the D-Rats repository.

wb8tyw commented 10 months ago

Unfortunately it seems that the instructions to run build_pot.sh are not sufficient to generate needed mo files. The only way to create the mo files currently is to run the python_prebuild.py, which requires having a virtualenv setup as per in the README.md

wb8tyw commented 10 months ago

Fixed build_pot.sh for future PR:

#!/bin/bash

set -uex

# First create the base.pot file
xgettext -d D-RATS -o locale/base.pot -D . *.py

# Next directory - Because of an odd string in ax25 need to
# specify a --from-code
xgettext -d D-RATS -o locale/base.pot -j --from-code ISO-8859-15 d_rats/*.py
# Repeat for each directory
# Any warnings probably need to be looked at.
xgettext -d D-RATS -o locale/base.pot -j d_rats/map/*.py
xgettext -d D-RATS -o locale/base.pot -j d_rats/sessions/*.py
xgettext -d D-RATS -o locale/base.pot -j d_rats/ui/*.py
xgettext -d D-RATS -o locale/base.pot -j -L Glade ui/*.glade

for file_name in $(find locale -name '*.po'); do
    locale_dir="$(dirname "$file_name")"
    msgfmt -o "$locale_dir/D-RATS.mo" "$locale_dir/D-RATS"
done
KP4AJ commented 10 months ago

Hi John:

Thanks. Here the result: dminuser@emcommpr:/installs/GitHub/D-Rats$ sudo ./build_pot.sh

The .mo file got created. However D-Rats still refuses to start.

dminuser@emcommpr:/installs/GitHub/D-Rats$ sudo ./d-rats.py 09/24/2023 18:20:48:INFO:D-Rats:main: re-config option found -- Reconfigure D-rats 09/24/2023 18:20:48:INFO:D-Rats:main: args.config = /root/.d-rats-ev 09/24/2023 18:20:48:INFO:DratsConfig:File /root/.d-rats-ev/d-rats.config 09/24/2023 18:20:48:INFO:DratsConfig:/root/D-RATS Shared 09/24/2023 18:20:48:INFO:MainApp:_refresh_lang: Loading locale `en' 09/24/2023 18:20:48:INFO:MainApp:_refresh_lang: Locale dir is: /installs/GitHub/D-Rats/locale 09/24/2023 18:20:48:INFO:MainApp:D-RATS v0.4.1.dev17-ga0b0c90-dirty starting at Sun Sep 24 18:20:48 2023 on Platform UnixPlatform: configuration: /root/.d-rats-ev system_data: /installs/GitHub/D-Rats OS version: Linux - Ubuntu 22.04.3 LTS 09/24/2023 18:20:54:INFO:D-Rats:---- GUI Exception ---- %s ---- End ---- Stack (most recent call last): File "/installs/GitHub/D-Rats/./d-rats.py", line 94, in handle_exception MODULE_LOGGER.info("---- GUI Exception ----\n%s\n---- End ----\n",

same result if I invoke via /usr/bin/python3.10: adminuser@emcommpr:/installs/GitHub/D-Rats$ sudo /usr/bin/python3.10 /installs/GitHub/D-Rats/d-rats.py 09/24/2023 18:22:22:INFO:D-Rats:main: re-config option found -- Reconfigure D-rats 09/24/2023 18:22:22:INFO:D-Rats:main: args.config = /root/.d-rats-ev 09/24/2023 18:22:22:INFO:DratsConfig:File /root/.d-rats-ev/d-rats.config 09/24/2023 18:22:22:INFO:DratsConfig:/root/D-RATS Shared 09/24/2023 18:22:22:INFO:MainApp:_refresh_lang: Loading locale `en' 09/24/2023 18:22:22:INFO:MainApp:_refresh_lang: Locale dir is: /installs/GitHub/D-Rats/locale 09/24/2023 18:22:22:INFO:MainApp:D-RATS v0.4.1.dev17-ga0b0c90-dirty starting at Sun Sep 24 18:22:22 2023 on Platform UnixPlatform: configuration: /root/.d-rats-ev system_data: /installs/GitHub/D-Rats OS version: Linux - Ubuntu 22.04.3 LTS 09/24/2023 18:22:26:INFO:D-Rats:---- GUI Exception ---- %s ---- End ---- Stack (most recent call last): File "/installs/GitHub/D-Rats/d-rats.py", line 94, in handle_exception MODULE_LOGGER.info("---- GUI Exception ----\n%s\n---- End ----\n", adminuser@emcommpr:/installs/GitHub/D-Rats$

Thanks for your help!

Edfel

wb8tyw commented 10 months ago
09/24/2023 18:20:48:INFO:MainApp:_refresh_lang: Locale dir is: /installs/GitHub/D-Rats/locale
09/24/2023 18:20:48:INFO:MainApp:D-RATS v0.4.1.dev17-ga0b0c90-dirty starting at Sun Sep 24 18:20:48 2023 on Platform UnixPlatform:
configuration: /root/.d-rats-ev
system_data: /installs/GitHub/D-Rats

Unfortunately the feature of D-Rats of putting up the GUI exception means that the information needed to diaglose the problem is only in the GUI popup in a section that must b expanded. None of that critical information makes it into the message log.

Nothing in d-rats or the d-rats repeater requires root privileges. It is an extremely unsafe practice to use the root account for anything other than system maintenance. Running d-rats or d-rats_repeater from root will not be allowed in a future update to d-rats.

KP4AJ commented 10 months ago

Roger that John! Thanks for looking at this. Will re-check my setup. Appreciated.

73'

Edfel KP4AJ

KP4AJ commented 10 months ago

John: Not sure if this could help: Traceback (most recent call last):

File "/installs/GitHub/D-Rats/./d-rats.py", line 250, in main()

File "/installs/GitHub/D-Rats/./d-rats.py", line 228, in main app = mainapp.MainApp(safe=args.safe)

File "/installs/GitHub/D-Rats/d_rats/mainapp.py", line 380, in init if not self.config.show():

File "/installs/GitHub/D-Rats/d_rats/config.py", line 2720, in show drats_ui = DratsConfigUI(self, parent)

File "/installs/GitHub/D-Rats/d_rats/config.py", line 2530, in init self.build_ui()

File "/installs/GitHub/D-Rats/d_rats/config.py", line 2616, in build_ui addpanel(DratsGPSPanel, "gps", ("GPS config"), prefs, self)

File "/installs/GitHub/D-Rats/d_rats/config.py", line 2591, in add_panel panel = c_arg(self.config, *args)

File "/installs/GitHub/D-Rats/d_rats/config.py", line 1403, in init dprs_code = dprs_info['code']

KeyError: 'code'

73'

Edfel

KP4AJ commented 10 months ago

John: Changed folder permissions and executed from user 'adminuser' (no sudo). Per the build_pot.sh fix .mo file was created and at locale/en/LC_MESSAGES dir: adminuser@emcommpr:/home/D-Rats$ ./d-rats.py 09/25/2023 12:44:32:INFO:D-Rats:main: re-config option found -- Reconfigure D-rats 09/25/2023 12:44:32:INFO:D-Rats:main: args.config = /home/adminuser/.d-rats-ev 09/25/2023 12:44:32:INFO:DratsConfig:File /home/adminuser/.d-rats-ev/d-rats.config 09/25/2023 12:44:32:INFO:DratsConfig:/home/adminuser/D-RATS Shared 09/25/2023 12:44:32:INFO:MainApp:_refresh_lang: Loading locale `en' 09/25/2023 12:44:32:INFO:MainApp:_refresh_lang: Locale dir is: /home/D-Rats/locale 09/25/2023 12:44:32:INFO:MainApp:D-RATS v0.4.1.dev17 starting at Mon Sep 25 12:44:32 2023 on Platform UnixPlatform: configuration: /home/adminuser/.d-rats-ev system_data: /home/D-Rats OS version: Linux - Ubuntu 22.04.3 LTS 09/25/2023 12:44:36:INFO:D-Rats:---- GUI Exception ---- %s ---- End ---- Stack (most recent call last): File "/home/D-Rats/./d-rats.py", line 94, in handle_exception MODULE_LOGGER.info("---- GUI Exception ----\n%s\n---- End ----\n",

This is a Ubuntu Laptop with GtK3 installed.

Edfel

wb8tyw commented 10 months ago

Click ignore the ignore or similar button on the error popup when it comes up, it is not fatal, and is only present at the current tip of the master branch.

Then go into the Preferences menu, GPS Config, and Edit a new Default GPS Comment. The edit button forces the Default GPS comment to be in a valid format now. In the past the default value of the Default GPS comment was not a valid GPS comment.

This will be fixed in a future PR.

KP4AJ commented 10 months ago

John, it causes a crash, program closes after pressing ignore or ignore all. No access to go into Preferences. Maybe a manual cp of a config file into the directory could work. But my interest is help make it work without manual work around.

Very appreciated your work with D-Rats.

Edfel KP4AJ

wb8tyw commented 10 months ago

Inside of ~/.d-rats-ev/d-rats.config find the line that starts with "default_gps_comment =". First save what is in there now line and add that to the ticket with double quotes around the paste.

This string I know should not crash if put in the file exactly: default_gps_comment = LY MY HOME2*58

The "LY" is for the DPRS icon of a house with beam antenna on it, the *58 is a checksum for the text up to that point. D-Rats has always required that string to have a valid 2 letter DPRS code and a valid checksum, it just did not always visibly report the configuration error. What D-RATS was previously not aware is that the some DPRS codes can actually have 3 characters, where the 3rd character is optional.

That should allow D-Rats to start so that you can use the EDIT button in preferences as above to modify the text and icon in the message.

wb8tyw commented 10 months ago

This is from a different branch than master, so the line numbers might not be right. I is unlikely that I will get the pull request that will include this fix ready before at least next week.

diff --git a/d_rats/config.py b/d_rats/config.py
index 9fd5b73..ee287f1 100755
--- a/d_rats/config.py
+++ b/d_rats/config.py
@@ -1386,23 +1386,27 @@ class DratsGPSPanel(DratsPanel):
                 config.set("settings", "default_gps_comment", dprs)
                 val.child_widget.set_text(dprs)
                 dprs_info = APRSicons.parse_dprs_message(text=dprs)
-                dprs_code = dprs_info['code']
-                if 'overlay' in dprs_info:
-                    dprs_code = dprs_info['code'] + dprs_info['overlay']
-                aprs_code = AprsDprsCodes.dprs_to_aprs(
-                    code=dprs_code,
-                    default=AprsDprsCodes.APRS_FALLBACK_CODE)
-                pixbuf = APRSicons.get_icon(code=aprs_code)
-                dprs_icon.set_from_pixbuf(pixbuf)
+                if 'code' in dprs_info:
+                    dprs_code = dprs_info['code']
+                    if 'overlay' in dprs_info:
+                        dprs_code = dprs_info['code'] + dprs_info['overlay']
+                    aprs_code = AprsDprsCodes.dprs_to_aprs(
+                        code=dprs_code,
+                        default=AprsDprsCodes.APRS_FALLBACK_CODE)
+                    pixbuf = APRSicons.get_icon(code=aprs_code)
+                    dprs_icon.set_from_pixbuf(pixbuf)

         val = DratsConfigWidget(config, "settings", "default_gps_comment")
         val.add_text(20)
         val.set_sensitive(False)
         dprs_comment = config.get("settings", "default_gps_comment")
         dprs_info = APRSicons.parse_dprs_message(text=dprs_comment)
-        dprs_code = dprs_info['code']
-        if 'overlay' in dprs_info:
-            dprs_code = dprs_info['code'] + dprs_info['overlay']
+        if 'code' in dprs_info:
+            dprs_code = dprs_info['code']
+            if 'overlay' in dprs_info:
+            if 'overlay' in dprs_info:
+                dprs_code = dprs_info['code'] + dprs_info['overlay']
+        else:
+            dprs_code = '  '
         aprs_code = AprsDprsCodes.dprs_to_aprs(
             code=dprs_code,
             default=AprsDprsCodes.APRS_FALLBACK_CODE)
$ git diff d_rats/mainapp.py
diff --git a/d_rats/mainapp.py b/d_rats/mainapp.py
index bb8de57..7a80cf2 100755
--- a/d_rats/mainapp.py
+++ b/d_rats/mainapp.py
@@ -1186,7 +1186,7 @@ class MainApp(Gtk.Application):
                 fix.aprs_code = AprsDprsCodes.dprs_to_aprs(
                     code=dprs_code)
                 self.default_comment = comment
-        except (NoOptionError, DPRSInvalidCode):
+        except (KeyError, NoOptionError, DPRSInvalidCode):
             # silently fix this up.  Notifications here at info level will
             # flood the console log.
             self.logger.debug("_refresh_location comment='%s'",

There will also be a patch to change the default string to one that will pass the checksum but this code just falls back to making up its own string if the value in the configuration file is bad quietly, which is pretty close the what the old behavior was.

KP4AJ commented 10 months ago

Thanks John will test tomorrow after returning home from work.

Edfel KP4AJ