[python] Python CGI: nelze zapsat do souboru

Bones bones17 na gmail.com
Středa Březen 29 22:01:14 CEST 2006


Zdravim,

pisu CGI skript v Pythonu a chci zapsat nejaky text do souboru, ktery
ma pridelena read i write prava (na Unixu) a melo by tedy jit do nej v
pohode zapisovat. Jenze kdyz otevru soubor pro pridavani tak se vyhodi
tato hlaska:
IOErrorPython 2.3.5: /usr/bin/python
Wed Mar 29 20:55:11 2006

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.


 /usr/lib/cgi-bin/guestbook.cgi
   13

   14 if guest_name and guest_subject and guest_note != "":

   15     log_file = file("guestbook.log", "a")

   16     to_append = "\n<br />\nFrom: <b>%s</b>\n<br />Subject:
<b>%s</b>\n<br />Text of notation:<br />\n<p>%s</p><br />" %
(guest_name, guest_subject, guest_note)

   17     log_file.write(to_append)

log_file undefined, builtin file = <type 'file'>

IOError: [Errno 13] Permission denied: 'guestbook.log'
      args = (13, 'Permission denied')
      errno = 13
      filename = 'guestbook.log'
      strerror = 'Permission denied'

Vazne nevim cim to muze byt kdyz mam prava pridelena...

Diky za kazdou odpoved.

Bones


Další informace o konferenci Python