qwertyquerty / pypresence

A complete Discord IPC and Rich Presence wrapper library in Python!
https://qwertyquerty.github.io/pypresence/html/index.html
MIT License
644 stars 77 forks source link

Not detecting Discord #154

Closed hotsno closed 2 years ago

hotsno commented 2 years ago

I get the following error: pypresence.exceptions.DiscordNotFound: Could not find Discord installed and running on this machine. while Discord Canary is running on my M1 MacBook. It works with regular Discord though. It might have to do with the new ARM version of Discord that Discord Canary uses.

hotsno commented 2 years ago

Nevermind, restarting Discord Canary fixed it

hotsno commented 2 years ago

Reopened this because after some time, pypresence stops detecting the Discord install and crashes. After running the script again, it still doesn't detect it, but restarting Discord always fixes the pypresence error. Do note that I'm on a MacBook with an M1 chip, so there's some weirdness with my setup.

Edit: I've confirmed that it has nothing to do with my code. I restarted Discord, used my laptop for ~10 minutes, then tried running the following:

from pypresence import Presence
import time

rpc = Presence("918318639713763389")
rpc.connect()
rpc.update(large_image="logo")

while True:
    time.sleep(60)

and it gives the error:

Traceback (most recent call last):
  File "/Users/hotsno/Code/Random/test2.py", line 4, in <module>
    rpc = Presence("918318639713763389")
  File "/opt/homebrew/lib/python3.9/site-packages/pypresence/presence.py", line 13, in __init__
    super().__init__(*args, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/pypresence/baseclient.py", line 28, in __init__
    raise DiscordNotFound
pypresence.exceptions.DiscordNotFound: Could not find Discord installed and running on this machine.
siliconsniffer commented 2 years ago

I also tried to code an rpc with a Youtube Tut. (https://youtu.be/hgCpGP2tA8Q) Since I'm on an iPad, I use iSH which is an Linux Alpine Shell, after I tried "python3 rpc.py" this error occurred:

Traceback (most recent call last):
  File "/root/rpc.py", line 4, in <module>
    rpc = Presence("858365637896962049")
  File "/usr/lib/python3.9/site-packages/pypresence/presence.py", line 13, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/pypresence/baseclient.py", line 28, in __init__
    raise DiscordNotFound
pypresence.exceptions.DiscordNotFound: Could not find Discord installed and running on this machine.

Any idea how to solve this? Best regards

siliconsniffer commented 2 years ago

I thought playing around a bit might help, so i added this:


static void UpdatePresence()
{
    DiscordRichPresence discordPresence;
    memset(&discordPresence, 0, sizeof(discordPresence));
    discordPresence.state = "running .py";
    discordPresence.details = "Coding…";
    discordPresence.startTimestamp = 1507665886;
    discordPresence.largeImageKey = "largeimage";
    discordPresence.smallImageKey = "smallimage";
    Discord_UpdatePresence(&discordPresence);
}

from the discord developer portal and this is the error code:


 File "/root/rpc.py", line 8
    static void UpdatePresence()
           ^
SyntaxError: invalid syntax

How do i fix that?

TheSpookyCat commented 2 years ago

https://python.org

hotsno commented 2 years ago

Why did you close the issue?

hotsno commented 2 years ago

@lynx197 It's not detecting Discord for you because you're on an iPad... It only works with the desktop clients.

siliconsniffer commented 2 years ago

@hotsno Is there a way to emulate a desktop client on an iPad?

hotsno commented 2 years ago

@lynx197 No And @LewdNeko if you had taken 5 seconds to read the original issue before closing this you'd see that lynx's issue is completely unrelated

siliconsniffer commented 2 years ago

@hotsno Sorry then. Still a newbie to python and thought it had similar errors so it could've been related. But thanks anyways :)

TheSpookyCat commented 2 years ago

@hotsno please make a new issue as you resolved the original with a restart.