writing captcha image file

A

amaltasb

I have a script which generates captcha file on
/usr/local/apache/htdocs/captcha directory. The script is working fine
when i execute it from terminal>
/usr/local/bin/python generateCaptcha.cgi > and it writes to /htdocs/captcha directory

but when I execute the script through
http://www.mydomain.com/cgi-bin/generateCaptcha.cgi its failing at
im.save(file_name, 'JPEG')

I changed the permissions to 755.

Can anyone help me...

Thanks
 
A

amaltasb

I get this msg:
Traceback (most recent call last):
File "/usr/local/apache/cgi-bin/newuser.cgi", line 61, in ?
cstatus = im.save(file_name,'JPEG')
File "/usr/local/lib/python2.4/PIL/Image.py", line 1299, in save
fp = __builtin__.open(fp, "wb")
IOError: [Errno 13] Permission denied:
'/usr/local/apache/htdocs/captcha/t13uum15a2jgfj2sqg.jpg'
 
F

Fredrik Lundh

I get this msg:
Traceback (most recent call last):
File "/usr/local/apache/cgi-bin/newuser.cgi", line 61, in ?
cstatus = im.save(file_name,'JPEG')
File "/usr/local/lib/python2.4/PIL/Image.py", line 1299, in save
fp = __builtin__.open(fp, "wb")
IOError: [Errno 13] Permission denied:
'/usr/local/apache/htdocs/captcha/t13uum15a2jgfj2sqg.jpg'

that means exactly what it says: the user account that your CGI script
is running under is not allowed to write to that directory.

this is a Unix/Apache configuration issue, not really a Python issue. see
this apache FAQ entry for some additional info:

http://httpd.apache.org/docs/2.2/faq/error.html#error.permissiondenied

</F>
 
A

amaltasb

I changed the owner of the file to root using chown root newuser.cgi,
but still i m not able to write...
 
F

Fredrik Lundh

I changed the owner of the file to root using chown root newuser.cgi,
but still i m not able to write...

have you tried asking in a unix or apache forum, or do you expect
pythoneers to help you with all your computer-related problems ?

</F>
 
J

John Draper

I changed the owner of the file to root using chown root newuser.cgi,
but still i m not able to write...
Are you running Apache in Chrooted mode? If so, then that might be your
problem.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top