Permission denied when trying to link pycharm to dockerized django venv - python

I'm trying to connect pycharm to the django dockerized venv but pycharm get an error about permission denied. "Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/usr/src/qatrackplus/deploy/docker/user-data/.venv": permission denied: unknown"
I already tried to chmod +777 the venv folder in case of rights problem but, pycharm still can't access it...

The solution was to point .../.venv/bin/python and not just .../.venv/ (int the docker file system btw). Why pycharm returned me permission error still haunt my mind but that works now :).

Related

Why am I getting PermissionError [Errno 13] when attempting to write to log in Flask hosted by Apache?

I am running Flask 1.1.4 via Python 3.5.3, hosted via an Apache 2 server on Debian Stretch. I am attempting to log various messages from the program, using the python logging module. This works normally. However, if I restart the Apache server using sudo service apache2 restart, the Flask application errors out with PermissionError: [Errno 13] Permission denied: (log file name). Is this an issue anyone else has run into?
If it is not a permissions issue, this usually happens (happened to me a few times) if you are using a relative path for the log file.
The current working directory for an app running with mod_wsgi is not the directory the the app is in. If you are using a relative path for the log file you can try to use absolute path instead.
More info here: https://modwsgi.readthedocs.io/en/master/user-guides/application-issues.html#application-working-directory
It turns out that there was a cron process that was editing the ownership of all files in my log folder to root. Once the program was restarted and needed to re-obtain the file reference, it was unable to do so.

"Permission denied" Error in Django Application Deployed on Amazon Elastic Beanstalk

I have deployed a Django project (MyProj) to Amazon beanstalk using the eb CLI. This project is physically located at ~/MyProj. It has an app, named myapp, which needs to execute external python scripts. For this purpose, I have my_launcher.py in ~/MyProj/myapp directory. A code snippet in my_launcher.py is:
import os
import importlib
PROJECTS_DIR = os.path.join(os.path.expanduser(os.environ.get('LOCATION')), 'app/python/')
MY_MODULE = os.path.join(PROJECTS_DIR, 'MyModule/my_script.py')
spec = importlib.util.spec_from_file_location('my_script', My_MODULE)
MyModule = importlib.util.module_from_spec(spec)
spec.loader.exec_module(MyModule)
The reason for using the environment variable LOCATION is to dynamically set the location of external python scripts. I have defined this environment variable and some others through the AWS admin console under the Elastic Beanstalk section. In my example, I have:
LOCATION = '/home/ec2-user/company/'
This script fails at the last line with the error:
PermissionError at /myapp
[Errno 13] Permission denied: '/home/ec2-user/company/app/python/MyModule/my_script.py'
The things I have done so far to no avail:
After reading many online pages (e.g., Django [Errno 13] Permission denied: '/var/www/media/animals/user_uploads'), I thought the issue is Linux permissions on the location where the executable python scripts are (i.e., /home/ec2-user/company/app/python/). For the sake of testing this hypothesis (even though I know it is a bad approach for production), I ran the command sudo chmod -R 777 company while being in /home/ec2-user directory. I redeployed the project and even rebooted the EC2 instance all together. This didn't help.
I moved the company directory inside ~/MyProj/myapp (and updated the environment variable LOCATION on the server) thinking that the wsgi user does not have execution permission on any directory outside ~/MyProj/myapp. This didn't help.
I highly appreciate any help.
By the way, I am using python 3.6 and Django 2.1.7.

I got an error while using "git push heroku master" command

When I'm trying to push python project on heroku using git push heroku master
command I got an error like this.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
How can I solve this error?
You have to add your ssh keys to heroku by running heroku keys:add. Heroku can then verify you and allow access to your repository on heroku. More on this here: https://devcenter.heroku.com/articles/keys

eb.exe deploy": Errno 13 Permission denied: './pagefile.sys'

I am compiling a website using TeamCity on a server and need to deploy the compiled website to AWS.
As my last build step, I use the Elastic Beanstalk CLI to deploy: "C:\Python34...\eb.exe deploy".
eb init has already been run...but whenever I run "eb deploy", (even when I run it from the command line in an empty directory--which should deploy a default project to AWS), an error appears saying:
Error: PermissionError :: [Errno 13] Permission denied: './pagefile.sys'
I have already run the command on my local machine without any problems; I receive the error on the server regardless of whether I am running the command line as an administrator.
I am wondering if this is a permissions issue with the server, or something else? I haven't been able to achieve much insight from the other questions, because they seem to have been solved on a case-by-case basis.
pagefile.sys is the Windows swap file.
It is a special file which cannot be written or manipulated. Whatever your command is doing you need to fix your command so it that doesn't touch this file and ignores it.

python os.makedirs Error 13 permission denied

I have a server set up on apache.
So when i run it and i upload a few files from a different machine. The server crashes here..
os.makedirs('data/%d' % stat.id)
The server crashes and it gives me this error
[Errno 13] Permission denied: 'data'
I have googled it and looked at other posts, I tried, but nothing works.
I have tried changing the group and chmod, chown..
Apache was making a directory under root.
I had to change the directory and it works.
os.chdir('...')
And when i create directory, its fine.

Categories

Resources