Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught FileNotFoundError on Discord RPC connection #45

Closed
ariacorrente opened this issue Apr 15, 2021 · 1 comment
Closed

Uncaught FileNotFoundError on Discord RPC connection #45

ariacorrente opened this issue Apr 15, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@ariacorrente
Copy link

Describe the bug
Running Rare from a cloned repository throws this error:

  File "/mnt/dep/dev/Rare/rare/app.py", line 80, in start_app
    self.mainwindow = MainWindow(self.core, self.args)
  File "/mnt/dep/dev/Rare/rare/components/main_window.py", line 42, in __init__
    self.rpc.set_discord_rpc(game[0])  # Appname
  File "/mnt/dep/dev/Rare/rare/utils/rpc.py", line 58, in set_discord_rpc
    self.RPC.connect()
  File "/mnt/dep/dev/Rare/env/lib/python3.8/site-packages/pypresence/presence.py", line 43, in connect
    self.loop.run_until_complete(self.handshake())
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/mnt/dep/dev/Rare/env/lib/python3.8/site-packages/pypresence/baseclient.py", line 128, in handshake
    self.sock_reader, self.sock_writer = await asyncio.open_unix_connection(self.ipc_path, loop=self.loop)
  File "/usr/lib/python3.8/asyncio/streams.py", line 111, in open_unix_connection
    transport, _ = await loop.create_unix_connection(
  File "/usr/lib/python3.8/asyncio/unix_events.py", line 244, in create_unix_connection
    await self.sock_connect(sock, path)
  File "/usr/lib/python3.8/asyncio/selector_events.py", line 494, in sock_connect
    return await fut
  File "/usr/lib/python3.8/asyncio/selector_events.py", line 499, in _sock_connect
    sock.connect(address)
FileNotFoundError: [Errno 2] No such file or directory
./start.sh: line 2: 16831 Aborted                 python3 rare

I do not heave any discord application or account. The current commit I see is 14bd150 .
This following quoted patch fixed the problem but I have no idea what is the meaning of a FileNotFound exception for the connect() function.

diff --git a/rare/utils/rpc.py b/rare/utils/rpc.py
index e74cbfe..be499a1 100644
--- a/rare/utils/rpc.py
+++ b/rare/utils/rpc.py
@@ -60,6 +60,10 @@ class DiscordRPC(QObject):
                 logger.warning("Discord is not active\n" + str(e))
                 self.RPC = None
                 return
+            except FileNotFoundError as e:
+                logger.warning("File not found error\n" + str(e))
+                self.RPC = None
+                return
         self.update_rpc(app_name)
 
     def update_rpc(self, app_name=None):

To Reproduce

git clone https://github.com/Dummerle/Rare.git
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
./start

After the initial download of resources the program will quit with the error quoted above.

System information:

  • OS: KDE neon User Edition 5.21 based on Ubuntu 20.04
  • Python version: 3.8.5
@ariacorrente ariacorrente added the bug Something isn't working label Apr 15, 2021
@Dummerle
Copy link
Collaborator

That's a weird error. Maybe you have a corrupt python installation.

I will add the except FileNotFoundError block to avoid this error

Dummerle added a commit that referenced this issue Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants