I installed my own package via sudo python setup.py install
locally. In its source code there's the code which causes OSError: (13, 'Permission denied', '....')
:
curr_dir = os.path.dirname(os.path.realpath(__file__))
if not os.path.exists(os.path.dirname(os.path.join(curr_dir, "dir1/log1.out"))):
os.makedirs(os.path.dirname(os.path.join(curr_dir, "dir1/log1.out")))
curr_dir is:
/usr/local/lib/python2.7/site-packages/my_app-1.2.3-py2.7.egg/my_app
And:
$ ls -al '/usr/local/lib/python2.7/site-packages/my_app-1.2.3-py2.7.egg/my_app'
total 696
drwxr-xr-x 35 root admin 1190 Mar 29 12:00 .
drwxr-xr-x 4 root admin 136 Mar 29 12:00 ..
-rw-r--r-- 1 root admin 108 Mar 29 12:00 __init__.py
-rw-r--r-- 1 root admin 202 Mar 29 12:00 __init__.pyc
-rw-r--r-- 1 root admin 11964 Mar 29 12:00 file1.py
-rw-r--r-- 1 root admin 12953 Mar 29 12:00 file1.pyc
-rw-r--r-- 1 root admin 13424 Mar 29 12:00 file2.py
-rw-r--r-- 1 root admin 15621 Mar 29 12:00 file2.pyc
.....
How can I fix it?
P.S. Even I create a file curr_dir, "dir1/log1.out
manually by mkdir and touch, the python code also throws the same exception while being executed.