Frewacom / pywalfox

Dynamic theming of Firefox (and Thunderbird) using your Pywal colors
https://addons.mozilla.org/en-US/firefox/addon/pywalfox/
Mozilla Public License 2.0
583 stars 12 forks source link

Failed to connect to socket #67

Closed akirwan361 closed 3 years ago

akirwan361 commented 3 years ago

Hey,

Just ran into this issue recently and can't figure it out. Hopefully it's an easy fix!

When I run pywalfox update it get the error:

ERROR:root:Failed to connect to socket: Connection refused

The output from the log is:

[06-09-2021 10:41:33] DEBUG:Using python 3.7.8 [06-09-2021 10:41:33] DEBUG:Firefox profile path is relative [06-09-2021 10:41:33] DEBUG:Found chrome directory at path: /home/voekreb/.mozilla/firefox/yv0qj2aq.default-release-1594812527610/chrome [06-09-2021 10:41:33] DEBUG:Default UNIX-socket is already in use [06-09-2021 10:41:33] DEBUG:Setup socket server using AF_UNIX (linux/darwin) [06-09-2021 10:41:33] DEBUG:Successfully bound socket to: /tmp/pywalfox_socket_alt [06-09-2021 10:41:38] DEBUG:Running cleanup [06-09-2021 10:41:38] DEBUG:UNIX-socket deleted

At first I thought the issue might have been that in the pywalfox.json file, something was wrong with the path line. I checked and it exists; one issue though was that main.sh was giving an error because of sw_vers. I tried commenting that out and trying again, but the same issue persists. I uninstalled everything, including Firefox, and reinstalled to try again with an earlier version. I tried versions 2.7 and 2.6, and still get the same error.

I also noticed that the chrome directory path is actually not the same as what shows up in Firefox's about:support page. I tried running the program with the Firefox profile in the path line but I still get the same issue. And with both profiles, the browser add-on just gives the error that there's no connection to the daemon.

Let me know what else you need!

Frewacom commented 3 years ago

Definitely seems to be some issue with the setup, since the addon can not connect to the messaging host. Fixing this should fix your issue with pywalfox update as well.

Did this happen to your existing installation or were you in the process of installing Pywalfox for the first time?

I also noticed that the chrome directory path is actually not the same as what shows up in Firefox's about:support page. I tried running the program with the Firefox profile in the path line but I still get the same issue. And with both profiles, the browser add-on just gives the error that there's no connection to the daemon.

The incorrect chrome directory path should not affect anything, other than you not being able to use the built-in CSS files. Make sure to set the path property of pywalfox.json to the path that is set after running pywalfox install.

I would suggest taking a look at the Browser console for any connection errors if you have not done that already.

akirwan361 commented 3 years ago

Did this happen to your existing installation or were you in the process of installing Pywalfox for the first time?

This happened to the existing installation. I ran pywalfox update and it gave those errors, so then it led me down that wormhole. I will check the browser console in the morning to see what I can suss out and I'll let you know. Would it be more useful for you if I post a screenshot? I'll be looking for anything related to connection errors but there's the strong chance your eyes will notice something mine don't.

Thanks for getting back to me!

Frewacom commented 3 years ago

Yes, a screenshot would be helpful. Considering that your issue occured in an existing installation is weird though. It sounds like the issue might be something else.

Another thing you could try is to quit Firefox and delete /tmp/pywalfox_socket and /tmp/pywalfox_socket_alt (if they still exist after Firefox has been closed). After that you can start Firefox again and run pywalfox update.

Thanks for getting back to me!

Of course!

akirwan361 commented 3 years ago

Okay, so I removed the /tmp/pywalfox_socket files. The browser console showssome unrelated warnings and exceptions, but the relevant ones say:

stderr output from native app pywalfox: /usr/bin/python: No module named pywalfox stderr output from native app pywalfox: /usr/bin/python3: No module named pywalfox stderr output from native app pywalfox: /usr/bin/python2.7: No module named pywalfox

That actually makes sense because my python executables are in ~/.pyenv/shims. The question now is why shims seems to work everywhere else but here. Will I need to try install on the system version of python then? Or is there another fix?

Frewacom commented 3 years ago

Firefox will use the python defined in the global path, i.e. /usr/bin/pythonx, which is why it won't work. I suppose a fix would be to simply install Pywalfox using one of the global python executables (if you still have one of those?).

Something like this:

/usr/bin/python -m pip install pywalfox

and make sure to re-run pywalfox install after installing.

akirwan361 commented 3 years ago

Yep, that did it! Maybe I will figure out the shims thing someday but it's not an issue for me now. Thanks for the very fast help! I've really enjoyed the eye candy your app has allowed :)