Live data from Hacker News

Need help!: Python [Errno 13] Permission denied: 'artsciimg.png'

news.ycombinator.com

1–7 of 7 posts

Need help!: Python [Errno 13] Permission denied: 'artsciimg.png'

#1
Hi guys, I really need help figuring out this error on Python. This python script works fine on my local computer, but when I push it to my server, it is showing error when the script tries to save an Image. Here's my code:

def magic(usrInput):

.

.

.

     im = Image.new("RGB",(x,y))

     for j in range(y):

         for i in range(x):
.

.

.

     im.save("artsciimg.png")
#End of code

And the error says: "[Errno 13] Permission denied: 'artsciimg.png'"

My local PC is running on Windows, and my server is on Ubuntu. I really need to know what's going on, the project is due in less than 36 hours :(

Re: Need help!: Python [Errno 13] Permission denied: 'artsciimg.png'

#7
post #6

Try im.save("/tmp/artsciimg.png"). This will most likely show that it's a local permission error. Then identify which directory it's trying to write to with os.system("pwd") and chmod 777 that directory.

Holy shit! The error stopped. Thanks soo much. In fact, the error is, I was supposed to give absolute path for im.save() but your answer ("/tmp/artsciimg.png") showed me the way, Thank you :)