News for hackers. Stuff that matters.

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

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 :(

( 6 comments | on HN )
Re:Need help!: Python [Errno 13] Permission denied: 'artscii... by nkuttler on Tuesday December 03, 2013 @06:57AM (#6839756)
The people in #python on the freenode IRC network are usually quite helpful. Try http://webchat.freenode.net/?channels=%23python&uio=OT10cnVl... if you don't have a real IRC client.
Re:Need help!: Python [Errno 13] Permission denied: 'artscii... by casca on Tuesday December 03, 2013 @07:26AM (#6839850)
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.

Re:Need help!: Python [Errno 13] Permission denied: 'artscii... by bl00djack on Tuesday December 03, 2013 @07:51AM (#6839926)
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 :)
Re:Need help!: Python [Errno 13] Permission denied: 'artscii... by mr_timppa on Tuesday December 03, 2013 @07:10AM (#6839793)
U should check your server rights were you are writing image. Is there write permission (-rw-rw-r--). Check it like command ls -l your/directory. If not add chmod a+r your/directory
Re:Need help!: Python [Errno 13] Permission denied: 'artscii... by bl00djack on Tuesday December 03, 2013 @07:03AM (#6839774)
I have tried chmod to all the folders, and files, it still doesn't work :(
Re:Need help!: Python [Errno 13] Permission denied: 'artscii... by erekel on Tuesday December 03, 2013 @06:56AM (#6839753)
man chown man chmod