permissions

Python pytesseract problem to open '[Errno 13] Permission denied:' in Mac

Python pytesseract problem to open '[Errno 13] Permission denied:' in Mac Question: I am having trouble with pytesseract in python. When I call the file in the code it says permission is denied. I am working on Mac, so I do not know what to do but I hope you can help me. #from every …

Total answers: 3

How to set permissions per handler function with APIView?

How to set permissions per handler function with APIView? Question: I am writing an API for a small school-related project using Django and Django-Rest-Framework. I am trying to figure out permissions. I am using APIView for my views, and am looking to set different permissions for each handler method without writing more views. Here is …

Total answers: 2

Why is os.fchmod not working with a socket file descriptor?

Why is os.fchmod not working with a socket file descriptor? Question: I’m trying to use os.fchmod() as specified in this tutorial. However, when I pass in a file descriptor and a mode, I get back a vague "Invalid Argument" error. import socket import stat import os s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) os.fchmod(s.fileno(), stat.S_IRWXO) How do I …

Total answers: 1

Matplotlib Savefig will NOT overwrite old files

Matplotlib Savefig will NOT overwrite old files Question: This seems like it must be a permissions issue on my machine. After a systems update on Windows 10, when I run: import matplotlib.pyplot as plt #make figure plt.plot([1,2,3,4]) plt.ylabel(‘some numbers’) #save plt.savefig(“./figs/my_plot.jpg”) It will create the figure the first time the code is run. If I …

Total answers: 3

Permissions to Django Admin Actions

Permissions to Django Admin Actions Question: I have written some custom actions for my django project, however cannot work out how to make them available to only superusers. I have tried putting an if statement round the actions line with Users.is_superuser but it keeps giving me an error saying there is no attribute called is_superuser. …

Total answers: 5

How do you create in python a file with permissions other users can write

How do you create in python a file with permissions other users can write Question: How can I in python (3) create a file what others users can write as well. I’ve so far this but it changes the os.chmod(“/home/pi/test/relaxbank1.txt”, 777) with open(“/home/pi/test/relaxbank1.txt”, “w”) as fh: fh.write(p1) what I get —sr-S–t 1 root root 12 …

Total answers: 5

pip install failing with: OSError: [Errno 13] Permission denied on directory

pip install failing with: OSError: [Errno 13] Permission denied on directory Question: pip install -r requirements.txt fails with the exception below OSError: [Errno 13] Permission denied: ‘/usr/local/lib/…. What’s wrong and how do I fix this? (I am trying to setup Django) Installing collected packages: amqp, anyjson, arrow, beautifulsoup4, billiard, boto, braintree, celery, cffi, cryptography, Django, …

Total answers: 8

PermissionError [errno 13] when running openpyxl python script in Komodo

PermissionError [errno 13] when running openpyxl python script in Komodo Question: I am having trouble using openpyxl scripts in Komodo edit 9 and python 3.4 on Windows 7. I copied some openpyxl code to learn, but it won’t execute from Komodo. I receive a permission error 13. I checked my path and python34 is present. …

Total answers: 4

Django REST Framework – Separate permissions per methods

Django REST Framework – Separate permissions per methods Question: I am writing an API using Django REST Framework and I am wondering if can specify permissions per method when using class based views. Reading the documentation I see that is quite easy to do if you are writing function based views, just using the @permission_classes …

Total answers: 10

Hide action in django admin if they don't have permission

Hide action in django admin if they don't have permission Question: I added an action in my admin pages that allows user to export selected records to an excel sheet. Now I need to be able to only allow some users to be able to export data. I have a UserProfile model that has a …

Total answers: 2