Python "native-messaging" web extensions on mac unable to read / write files on Downloads folder

Hi everyone.
I’m a novice developer with web extensions.

I used web-ext for a native-messaging web extension with Python, developed on Ubuntu, which I use with Firefox.

I use it to scan web pages and capture the contents of certain fields.
The scan result is sent to the python script which processes files locally.
Everything works fine on Linux.

I recently needed to port this web extension to macos (M1 chip - Sonoma 14.4) and I encountered a problem that I don’t understand what it depends on.

Python, trying to read files in the Downloads folder, gets a “PermissionError [errno 1] operation not permitted”.

In the various tests I did,

  • I changed the read/write rights of the Downloads folder
  • allowed access to the entire disk, in Privacy and Security, to both “terminal” and “Firefox”,
    but nothing changed.

Using the python in a shell, python reads and writes to Downloads without any problems.
All the javascript parts works correctly.

It seems as if python, when run as native messaging from web-ext, does not have rights to read/write to the Downloads folder.

Does anyone have a suggestion for me, please?

If necessary I can post the code, but the lines that fail are simple ‘with open’ (or ‘open(file,“r”)’) which work correctly on Linux and also on MacOS, if executed from a Python shell.

Sorry for my poor English and thanks to anyone who can answer me.

rfellons

This sounds like a macOS permissions issue. Check out this Apple support article on how to Control access to files and folders on Mac.

Hi @dotproto.
I solved the problem. I have granted disk access to Python.
Trivially.
Thanks for your reply.