0

I am trying to debug some application using Python 2.7.9 and Django 1.10 on FreeBSD.

Generally speaking I have two users with equal rights and permission but when I run django-shell using first user, and execute my script in the shell everything ok.

The problem starts when I try to execute the same script from second user, I get:

    File "/usr/local/lib/python2.7/shelve.py", line 223, in __init__
    Shelf.__init__(self, anydbm.open(filename, flag), protocol,     writeback)
    File "/usr/local/lib/python2.7/anydbm.py", line 85, in open
        return mod.open(file, flag, mode)
error: (13, 'Permission denied')

I set all directories in usr/local to has - chmod 777. First and second users are in the same groups and from my point of view has the same permissions.

Juan Leni
  • 6,982
  • 5
  • 55
  • 87
Vitalii
  • 13
  • 2
  • There is no enough information here. Could be anything. Looking at the traceback, it seems that the problem occurs trying to open some file using anydb library. Otherwise, it would help to at least know how your Django is setup and what is your script doing. – Mad Wombat Dec 22 '16 at 15:32
  • Django is setup up in the virtualenv. The script is trying to connect to gsx Apple service (I am totally sure that script is working, because it works on first user. I can post this script here if it will make some sense.) – Vitalii Dec 23 '16 at 08:43

1 Answers1

0

First of all, Your information is not enough to solve. But make sure that you are using virtualenv for your python development. If you are not using that then you have to use sudo in every case, which is bad practice. And another thing don't put 777 permission on /usr/local/lib/python2.7/ here. It may break your operating system features.

You can see the docs of virtualenv

  • I just don't know, what other information can be useful here. I am actually using virtualenv in my project, and I have permission-problems with those folders too: File "/opt/servo/env/src/../..", line 227, in function_name self.shelf = shelve.open(self.fp, protocol=-1 . error: (13, 'Permission denied') . – Vitalii Dec 23 '16 at 08:24
  • @Vitalii Did you activate you `virtualenv`? If you really done that then there is no reason to use global library. – Mohammad Ashraful Islam Dec 23 '16 at 11:25
  • Yes I activated it. But anydbm is a built in library in python, that why it use global library [Python] (https://docs.python.org/2/library/anydbm.html) – Vitalii Dec 27 '16 at 08:09