Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission Denied on image #50

Open
saitoh183 opened this issue Sep 19, 2016 · 14 comments
Open

Permission Denied on image #50

saitoh183 opened this issue Sep 19, 2016 · 14 comments

Comments

@saitoh183
Copy link

I dont know when it started but everytime i run plexEmail.py, it fails with this message

Traceback (most recent call last):
  File "/opt/plexEmail/scripts/plexEmail.py", line 782, in <module>
    imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)
  File "/opt/plexEmail/scripts/plexEmail.py", line 271, in processImage
    shutil.copy(imgLocation, img)
  File "/usr/lib/python2.7/shutil.py", line 119, in copy
    copyfile(src, dst)
  File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/var/www/html/plexEmail/images/07dff822e4d99b8ae4c5bb693e06ed7adffeb00d_c7f62e627843f4e17e59168370e56fae60e46b65.jpg'

The problem is that 07dff822e4d99b8ae4c5bb693e06ed7adffeb00d_c7f62e627843f4e17e59168370e56fae60e46b65.jpg does not exist in the image folder. Also when i check my Plex metadata folder(plex is on windows) and search for 07dff822e4d99b8ae4c5bb693e06ed7adffeb00d, it referes to a UFC poster. The weird thing is that everytime i get a new UFC poster, 07dff822e4d99b8ae4c5bb693e06ed7adffeb00d points to that new poster and not the previous one. How can i fix this?

@jakewaldron
Copy link
Owner

I just pushed new changes to the master branch that has a fix for posters. Could you please try it?

@saitoh183
Copy link
Author

It seems to work but did you remove the msg_header_image from the plexemail.py? Because my image is not in the email.

@jakewaldron
Copy link
Owner

Was that a custom change you made to the script? That field hasn't ever existed.

@saitoh183
Copy link
Author

i dont rememeber...lol..i have been using this same config file since the 0.2.0i guess i will change it header1

@saitoh183
Copy link
Author

@jakewaldron

What is the Fix for the logging because when i try to run python path/to/plexEmail.py -t i get a error that plexemail.log access denied (even if the group and user are the same as the other file). When i add sudo in front, it works.

@jakewaldron
Copy link
Owner

It adds logging to an external file. I'm guessing the user running the script doesn't have write access to the scripts folder (that's why it works with sudo). I'll have to add some permission checking in the next release.

@saitoh183
Copy link
Author

Humm.. Odd.. My www-data user is the owner and group and my user is part of the www-data group. Can I turn off logging?

@jakewaldron
Copy link
Owner

Does the group have write access to the folder?

The current release in the main branch cannot disable logging; however I just pushed a new change to the dev branch that adds this ability. Give it a shot and if you have no issues with it I will push it to the main branch.

@saitoh183
Copy link
Author

Ok.. Will give it a try. Yes the group had rw

@saitoh183
Copy link
Author

@jakewaldron

The log disabling works but now i have

WARNING:root:processImage: Failed to copy image - OSError(1, 'Operation not permitted')

Unless i run as sudo...this is if i run from cron or from terminal

Here are my permissions
http://pastebin.com/yj7Gci8p

@saitoh183
Copy link
Author

@jakewaldron

any ideas?

@striker1983
Copy link

Using shutil.copyfile instead of shutil.copy on plexemail.py will resolve this issue. The issue happens if the image file in the destination is owned by a use different than the one running the script.

@saitoh183
Copy link
Author

Ok, I will give it a try and post back

@ramsnerm
Copy link

ramsnerm commented Feb 3, 2017

I tested it and the solution works for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants