makeasnek/FindTheMag2

Call to logging error missing argument

Closed this issue · 3 comments

What triggered this error was a user error... I forgot to logoff/logon after adding my user to the boinc group so the user did not have the required access to the gui_rpc_auth.cfg file.
However the following crash occurred when FTM attempted to log the permissions error:

Press enter key to start controlling BOINC. Press Ctrl+C to quit

Starting control of BOINC...
Traceback (most recent call last):
  File "/home/piadm/FTM2/FindTheMag2/main.py", line 2638, in <module>
    print_and_log('Error connecting to BOINC client, does your gui_rpc_auth.cfg specify a password or a non-standard port?\n If so, be sure to include it in your config.py')
TypeError: print_and_log() missing 1 required positional argument: 'log_level'

Information:

  • RaspberryPi running Debian 11 Pi OS
  • No wallet installed
  • Boinc installed and configured
  • FTM2 pulled from git 2023-04-09 VERSION=2.2

I modified main.py to include the log level "ERROR" in the call to test the error handling:

diff --git a/main.py b/main.py
index 62a671f..39a9495 100644
--- a/main.py
+++ b/main.py
@@ -2635,7 +2635,7 @@ if __name__ == '__main__':
 
     verification_result = loop.run_until_complete(verify_boinc_connection(rpc_client))
     if not verification_result:
-        print_and_log('Error connecting to BOINC client, does your gui_rpc_auth.cfg specify a password or a non-standard port?\n If so, be sure to include it in your config.py')
+        print_and_log('Error connecting to BOINC client, does your gui_rpc_auth.cfg specify a password or a non-standard port?\n If so, be sure to include it in your config.py','ERROR')
         print('You can find your gui_rpc_auth.cfg at {}'.format(auth_location))
         print('Linux users: make sure your username is in the BOINC group so FTM can access your BOINC config file')
         print('sudo usermod -aG boinc your_username_here')
@@ -2655,4 +2655,4 @@ if __name__ == '__main__':
     # While we don't have enough tasks, continue cycling through project list and updating. If we have cycled through all projects, get_highest_priority_project will stall to prevent requesting too often
     boinc_loop(False,rpc_client)
     # Restore user prefs
-    safe_exit(None,None)
\ No newline at end of file
+    safe_exit(None,None)

This allowed the program to continue slightly but the following was generated; I'm not sure if this is intentional or if there is a more graceful way to exit on error.

Press enter key to start controlling BOINC. Press Ctrl+C to quit
Starting control of BOINC...
Error connecting to BOINC client, does your gui_rpc_auth.cfg specify a password or a non-standard port?
 If so, be sure to include it in your config.py
You can find your gui_rpc_auth.cfg at /var/lib/boinc-client/gui_rpc_auth.cfg
Linux users: make sure your username is in the BOINC group so FTM can access your BOINC config file
sudo usermod -aG boinc your_username_here
Note that you will need to restart your computer after changing your group permissions
Press enter to quit
Traceback (most recent call last):
  File "/home/piadm/FTM2/FindTheMag2/main.py", line 2644, in <module>
    loop.run_until_complete(prefs_check(rpc_client))
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/piadm/FTM2/FindTheMag2/main.py", line 1532, in prefs_check
    response = await rpc_client._request(req)
  File "/home/piadm/FTM2/FindTheMag2/libs/pyboinc/rpc_client.py", line 78, in _request
    return await self._raw_client.request(req)
  File "/home/piadm/FTM2/FindTheMag2/libs/pyboinc/_raw_client.py", line 82, in request
    return await self.receive()
  File "/home/piadm/FTM2/FindTheMag2/libs/pyboinc/_raw_client.py", line 63, in receive
    buff = [await self._read()]
  File "/home/piadm/FTM2/FindTheMag2/libs/pyboinc/_raw_client.py", line 57, in _read
    return await self._reader.readuntil(separator=END_OF_MESSAGE)
  File "/usr/lib/python3.9/asyncio/streams.py", line 629, in readuntil
    raise exceptions.IncompleteReadError(chunk, None)

Let me know if you need any further information or when you put a fix in if you want me to test it.

Aah yes thank you for pointing this out. Silly me pushing to repo without actually testing the new functionality :). It should now gracefully exit upon hitting that error.

@makeasnek Did you push the fix? I don't see it in the repo, currently.

Whoops I did but forgot to push, now its there