Use with flatpak
tobfromme opened this issue · 2 comments
This is an odd one. I tried to install Chrome via Flatpak ( https://flathub.org/apps/com.google.Chrome ).
You'll notice the command to execute it is flatpak run com.google.Chrome
. However, bing-rewards doesn't like this:
[user@host]$ bing-rewards -c 2
Doing 2 desktop searches
Unexpected error: [Errno 2] No such file or directory: 'flatpak run com.google.Chrome'
ERROR: Chrome could not be found on system PATH
Make sure it is installed and added to PATH,or use the --exe flag to give an absolute path
I tried putting the flatpak command in a script, but it errors differently:
[user@host]$ bing-rewards -c 2
Doing 2 desktop searches
Traceback (most recent call last):
File "/usr/bin/bing-rewards", line 8, in <module>
sys.exit(main())
File "/usr/lib/python3.10/site-packages/bing_rewards/__init__.py", line 331, in main
desktop()
File "/usr/lib/python3.10/site-packages/bing_rewards/__init__.py", line 310, in desktop
search(
File "/usr/lib/python3.10/site-packages/bing_rewards/__init__.py", line 233, in search
chrome = subprocess.Popen(
File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1847, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/user/runchrome'
Any idea what "Exec format error" may mean? It would help me get around this.
sigh You know, this happened before. I troubleshoot for a long time, come up short, so I open an issue, then suddenly I find an answer.
To solve, make the script to run the flatpak look like this:
#!/bin/sh
flatpak run com.google.Chrome
Ok, I am glad you found a fix.
This issue is due to the way the python process launches a new chrome instance. It is expecting to launch an executable called "chrome" or similar directly. It expects a path to a file on the system.
When run a Flatpak app, you actually are launching the flatpak
program and passing command line parameters 'run'
and 'com.google.Chrome'
. I don't use flatpak myself, but I am assuming that additional arguments to the flatpak command are passed to the running process.
You may need to format your script like flatpack run com.google.Chrome -- $@
or similar depending on how flatpak handles arguments sent to the launched process. This will be necessary to launch chrome with the --user-agent
flag that the script uses to set a mobile user agent.