I am using PyCharm 2020.2.3 with Python 3.8.6 under Pop_OS! 20.10 (you can probably do as if I am using Ubuntu 20.10) which is unable to see files into /usr/bin or /usr/lib.
Here is an example if I try to touch the /usr/lib/firefox/firefox binary file.
# main.py
import os
print(os.path.exists('/usr/lib'))
print(os.path.exists('/usr/lib/firefox'))
print(open('/usr/lib/firefox/firefox', 'r'))
From the command line, this works:
>>> python main.py
True
True
<_io.TextIOWrapper name='/usr/lib/firefox/firefox' mode='r' encoding='UTF-8'>
But when I run it in PyCharm, it fails like so:
True # Can see /usr/lib
False # Cannot see /usr/lib/firefox
Traceback (most recent call last):
File ..., line 5, in <module>
print(open('/usr/lib/firefox/firefox', 'r'))
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib/firefox/firefox'
Here are the permissions for usr/bin/firefox:
>>> ls -ld firefox
drwxr-xr-x 8 root root 4096 Oct 26 10:22 firefox
There are numerous questions regarding similar issues but most of them end up suggesting a work around related to the specific file required.
There seem to be some kind of permission issue and I want to tackle that without having to rely on a workaround.