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

Update seems to have broken the plugin #31

Closed GideonWolfe closed 3 years ago

GideonWolfe commented 4 years ago

I updated pywalfox with

pip3 --user --upgrade pywalfox

and ran git pull origin master in the directory I cloned pywalfox into.

When I open the plugin settings, it fails to fetch pywal colors, and the buttons for enabling the css files hang.

Every time I open Firefox, pywalfox prompts me for an update, even though I have already ran the steps above.

The url bar and drop down menu are no longer themed for me, suggesting the css is no longer working

pywalfox

Frewacom commented 4 years ago

Seems like you are still using the old daemon. You can remove the repository if you only used it for the daemon and use pip only from now on.

Also, make sure that the installed version is 2.3, by running pywalfox -v. If not, upgrade via pip.

Rerun the setup (pywalfox setup) and make sure that the manifest installation path that is outputted is in the .mozilla/native-messaging-hosts folder of your home directory, e.g. /home/<username>/.mozilla/native-messaging-hosts/pywalfox.json

GideonWolfe commented 4 years ago

Ok so I deleted the folder I had originally used to install pywalfox. I have already installed it with pip. pywalfox -v gives me

v2.3

I reinstalled the browser extension, which seems to default to v2.0.1 and then warns me about the version.

The output of pywalfox setup confirmed it's going to the right place

/home/gideon/.mozilla/native-messaging-hosts/pywalfox.json
GideonWolfe commented 4 years ago

When I try to run the daemon manually with pywalfox -p --verbose daemon

[05-24-2020 11:36:37] DEBUG:Using python 3.8.3
[05-24-2020 11:36:37] ERROR:Could not find default Firefox profile
[05-24-2020 11:36:37] DEBUG:Setup socket server using AF_UNIX (linux)
[05-24-2020 11:36:37] DEBUG:Successfully bound socket to: /tmp/pywalfox_socket
Frewacom commented 4 years ago

Do you get any errors? You can check the browser console Tools > Web developer > Browser console and also in about:debugging and click inspect on the Pywalfox addon.

What does the Debugging section of the extension say?

As for the CSS, the daemon can't find you profile directory so you won't be able to enable it from the Settings page. That might be fixed in the next update of the daemon.

GideonWolfe commented 4 years ago

Thanks for the timely responses. I'm not quite sure what I'm doing wrong. My buddy had the exact same issue with the pywalfox update and solved it by

  1. Removing cloned pywalfox folder
  2. Reinstalling firefox
  3. updating pywalfox pip module
  4. pywalfox setup

But this hasn't worked for me.

The only error messages I see are the ones depicted in the above image. For what it's worth when I switched to my laptop, the issue occurred there as well, yet I get no errors in the Debug window when I click buttons.

I've checked both the debugging areas you mentioned but nothing pywalfox related jumped out at me.

Frewacom commented 4 years ago

In the Debugging section, does it still say Connected and version not set?

GideonWolfe commented 4 years ago

Yep, exactly that.

Frewacom commented 4 years ago

I am kind of lost, to be honest.

If you run pywalfox update in your terminal, does that do something? Errors/debugging output, anything?

The daemon should be setup correctly since you weren't getting any errors, and the Connected means that the daemon have been started by Firefox and is currently running. If there were any errors with the daemon itself, it would have crashed and Firefox would have killed the connection.

GideonWolfe commented 4 years ago

pywalfox --verbose -p update

ERROR:root:Could not find socket: /tmp/pywalfox_socket
Frewacom commented 4 years ago

I forgot I implemented logging, perhaps that will tell us something. What does pywalfox log say?

GideonWolfe commented 4 years ago
[05-24-2020 11:35:46] DEBUG:Using python 3.8.3
[05-24-2020 11:35:46] DEBUG:Using python 3.8.3
[05-24-2020 11:35:46] ERROR:Could not find default Firefox profile
[05-24-2020 11:35:46] DEBUG:Setup socket server using AF_UNIX (linux)
[05-24-2020 11:35:46] DEBUG:Successfully bound socket to: /tmp/pywalfox_socket
[05-24-2020 11:36:08] DEBUG:Cleanup

These messages are an hour old, so no idea if more recent info exists.

Frewacom commented 4 years ago

By default, only errors are logged when running via Firefox. So, since there are errors, I think we can assume that either there are no errors, or the code did not execute.

GideonWolfe commented 4 years ago

I'm not too sure what changed on my end, but the issue appeared on both my machines and my friends machine after the update yesterday.

Please let me know if there's anything else I can do to assist on my end

Frewacom commented 4 years ago

Some things that you can try:

What does your ~/.mozilla/native-messaging-hosts/pywalfox.json look like? What path is the executable installed at whereis pywalfox? Is that path in your $PATH?

Try modifying the main.sh script (you can find the path in the pywalfox.json file) and replace pywalfox daemon with pywalfox daemon --verbose, restart Firefox, click some buttons in the Settings page and check the logs pywalfox log. You should see new output with the current time. If not, then the issue must be with the daemon setup.

Frewacom commented 4 years ago

Do you get any errors? You can check the browser console Tools > Web developer > Browser console and also in about:debugging and click inspect on the Pywalfox addon.

What does the Debugging section of the extension say?

As for the CSS, the daemon can't find you profile directory so you won't be able to enable it from the Settings page. That might be fixed in the next update of the daemon.

Could you also restart Firefox and post images of the output you got from there? There probably is nothing, but doesn't hurt to make sure.

GideonWolfe commented 4 years ago

Here is a screenshot

ff

GideonWolfe commented 4 years ago

And the console from about:debugging on pywalfox

ff

Frewacom commented 4 years ago

Nothing out of the ordinary it seems. Most of the errors are not even from Pywalfox.

GideonWolfe commented 4 years ago

I tried creating a new firefox profile. The issue persists of pywalfox not connecting, but the drop downs are themed, unlike on my usual profile... 2020-05-24-192757_2560x1600_scrot

GideonWolfe commented 4 years ago

It just seems like something is "sticking around", causing the pip version of pywalfox. Because the pip module is up to date. I deleted the original Pywalfox folder, are there any other straggler files that could cause this behavior?

I scrubbed the entire .mozilla directory of pywalfox but nothing works. It's broken on both my machines in the exact same way.

fubarhouse commented 4 years ago

I've done something similar as I have the same issue, perhaps this could be useful:

image

Note I currently have the daemon and logs running, and it still seems to think it's disconnected, even though the settings tab identifies it as connected

image

Paul-Houser commented 4 years ago

I had this same issue and was able to fix it by doing these steps in this order:

  1. Uninstall everything pywalfox related with pywalfox uninstall pip3 uninstall pywalfox
  2. Deleted all straggler files on my system related to pywal fox
  3. Uninstall firefox
  4. installed pywalfox from pip globally, rather than the user install
  5. install firefox and the pywalfox plugin

In terminal:

  1. pywalfox setup
  2. pywalfox update

Rebooted my computer after this and then went to the plugin settings page and was able to successfully fetch pywal colors.

It took me quite a while to get it to work after the update, and I tried lots of things before this, so maybe something I did earlier that isn't included here is also important to fixing it. The only notable thing I remember doing before this is deleting the directory $HOME/.mozilla/native-messaging-hosts, but I think that probably would've also been deleted when running pywalfox uninstall. Could be wrong though.

Frewacom commented 4 years ago

Running the setup of the previous version installed one single file; ~/.mozilla/native-messaging-hosts/pywalfox.json. Nothing else. It should not really be necessary to remove the old repo, reinstall Firefox or even restarting your system. It should be enough to run pywalfox setup, update the addon and restart Firefox.

Simply running pywalfox setup should replace the old pywalfox.json manifest and Firefox will automatically use the correct daemon, since it only runs what is defined in the manifest. The new and old setup are basically the same, except one was written in bash and the other in python.

One thing that came to mind is browser state. It should be the only thing that persists between versions and setups, so perhaps you could try the following and see if that makes a difference:

  1. Open the settings page of the addon
  2. Right click > Inspect element > Console
  3. Run browser.storage.local.clear() (will remove all saved data in local storage for Pywalfox)
  4. Restart Firefox
srappan commented 4 years ago

I manage to figure out a work around, seems there is some permission issues with the daemon

❯ pywalfox daemon
Traceback (most recent call last):
  File "/usr/bin/pywalfox", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/pywalfox/__main__.py", line 102, in main
    handle_args(args)
  File "/usr/lib/python3.8/site-packages/pywalfox/__main__.py", line 78, in handle_args
    setup_logging(args.verbose, args.print_mode)
  File "/usr/lib/python3.8/site-packages/pywalfox/utils/logger.py", line 43, in setup_logging
    create_rotating_log('', logging.ERROR) # use the root logger
  File "/usr/lib/python3.8/site-packages/pywalfox/utils/logger.py", line 16, in create_rotating_log
    handler = RotatingFileHandler(LOG_FILE_PATH, maxBytes=LOG_FILE_MAX_SIZE, backupCount=LOG_FILE_COUNT)
  File "/usr/lib/python3.8/logging/handlers.py", line 148, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python3.8/logging/handlers.py", line 55, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python3.8/logging/__init__.py", line 1143, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python3.8/logging/__init__.py", line 1172, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.8/site-packages/pywalfox/daemon.log'

Just running this command seems to work. sudo chown -R $USER /usr/lib/python3.8/site-packages/pywalfox/*

Frewacom commented 4 years ago

So the issue was fixed if you installed Pywalfox to /usr/lib rather than for your user only?

Either way, I should probably save the log file somewhere else and that permission issue should be fixed.

srappan commented 4 years ago

I believe pip places files there regardless of user or system install.

GideonWolfe commented 4 years ago

Hmm i'm not getting permissions issues, I installed the pywalfox module with the --user flag. Clearing the browser storage had no effect.

srappan commented 4 years ago

So when you install a module with Pip, regardless of user or global, files are placed in the /usr/lib/ area so if you don't have perms the daemon won't load and will crash.

I recommend running $ pywalfox daemon and seeing if it runs without error. You cannot run this as root, or using sudo as Firefox and the addon aren't run via root or sudo, so they can't talk to each other.

GideonWolfe commented 4 years ago

When I run pywalfox daemon, it just hangs with no output. When I run

pywalfox -p --verbose daemon, I get

[05-25-2020 12:05:50] DEBUG:Using python 3.8.3
[05-25-2020 12:05:50] DEBUG:Found chrome directory at path: /home/gideon/.mozilla/firefox/pw9fyemj.default-release/chrome
[05-25-2020 12:05:50] DEBUG:Setup socket server using AF_UNIX (linux)
[05-25-2020 12:05:50] DEBUG:Successfully bound socket to: /tmp/pywalfox_socket
srappan commented 4 years ago

Your daemon is workin fine. Are you still not able to use the add on?

GideonWolfe commented 4 years ago

Nope, I still am unable to connect to the daemon in the plugin settings window, and I get a warning about pywalfox being outdated every time I restart Firefox.


From: srappan notifications@github.com Sent: Monday, May 25, 2020 12:07 PM To: Frewacom/pywalfox pywalfox@noreply.github.com Cc: Gideon Wolfe wolfeg2@wwu.edu; Author author@noreply.github.com Subject: Re: [Frewacom/pywalfox] Update seems to have broken the plugin (#31)

Your daemon is workin fine. Are you still not able to use the add on?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FFrewacom%2Fpywalfox%2Fissues%2F31%23issuecomment-633687761&data=02%7C01%7Cwolfeg2%40wwu.edu%7Ce15b6c2d972c4eb9f27808d800deed05%7Cdc46140ce26f43efb0ae00f257f478ff%7C0%7C0%7C637260304756035920&sdata=czDBFRDTS1XsC7oPxzJll7Pm0w9NgF5oXV%2Bku%2BkABoY%3D&reserved=0, or unsubscribehttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAH3KPZFGQRWPFLDFOR4WZDLRTK6YRANCNFSM4NIXJTCQ&data=02%7C01%7Cwolfeg2%40wwu.edu%7Ce15b6c2d972c4eb9f27808d800deed05%7Cdc46140ce26f43efb0ae00f257f478ff%7C0%7C0%7C637260304756035920&sdata=HQlY8RE5JfHoKeH4CyJqA0vORXCG0il6LAzXlJqGWYA%3D&reserved=0.

fubarhouse commented 4 years ago

I'm getting the same as @GideonWolfe... ☹️

Paul-Houser commented 4 years ago

Hello again everyone, I had the same issue on my laptop when I updated it just now, and since I was able to solve it on my desktop, I kept track of exactly how I solved it on my laptop. Here's what I came up with, that successfully fixed the issue on my laptop:

uninstall the pywalfox extension in Firefox uninstall Firefox uninstall the pip module for pywalfox sudo tree -f / | grep pywalfox and delete anything that shows up reboot (probably not necessary) install Firefox install pywalfox extension in Firefox

WITH FIREFOX OPEN: pip install --upgrade pywalfox and sudo pip install --upgrade pywalfox (did both with and without sudo cause i was curious, both of them installed with out saying it was already installed... I don't know much about pip but maybe this is important) pywalfox setup close Firefox open Firefox, click fetch colors on pywalfox settings page

edit: I'm sure most of this is not necessary, but one or two of these steps are certainly what solves the issue.

GideonWolfe commented 4 years ago

@Paul-Houser can confirm that this fixed the issue on both my systems, and the second one worked without a reboot!

fubarhouse commented 4 years ago

It seems installing it via sudo and restarting has kicked it back into gear!

Frewacom commented 4 years ago

Any ideas as to why installing via sudo fixes the issue?

fubarhouse commented 4 years ago

Unfortunately not @Frewacom...

Despite not liking the need to do it, I would appreciate the findings of this issue make it into the readme or a wiki.

thrifty-txt commented 4 years ago

I experienced similar issues after pip installing with --user, with my Firefox plugin showing Connected and version not set. Fixed by adding the install folder of the pywalfox executable to my path variable, and restarting my X session to update the env for Firefox. No global install required.

thrifty-txt commented 4 years ago

If anyone reading this needs help changing their path variable, arch wiki has a good write-up: https://wiki.archlinux.org/index.php/Environment_variables#Defining_variables

Jacob-Stokes commented 3 years ago

I experienced similar issues after pip installing with --user, with my Firefox plugin showing Connected and version not set. Fixed by adding the install folder of the pywalfox executable to my path variable, and restarting my X session to update the env for Firefox. No global install required.

This worked for me to resolve the issue, no need to install with sudo.

Frewacom commented 3 years ago

I have pushed an update to the native messaging application (version 2.6) that I hope should fix this issue. It no longer requires you to have pywalfox in your PATH. Instead, it relies on having one of python/python3/python2.7 in your PATH, which a majority of you should have by default.

Frewacom commented 3 years ago

Closing for now.