Permission Problem
Victor Subervi
victorsubervi at gmail.com
Mon Mar 1 10:07:52 EST 2010
Never mind. I figured out my error.
beno
On Mon, Mar 1, 2010 at 10:02 AM, Victor Subervi <victorsubervi at gmail.com>wrote:
> Hi;
> I encountered and solved this problem before with the help of the list, but
> it's back, and I've reviewed and done everything I was shown to do last
> time, so I'm lost. Here's the script:
>
> #!/usr/bin/python
>
> import cgitb; cgitb.enable()
> import cgi
> import sys,os
> sys.path.append(os.getcwd())
> from login import login
> import MySQLdb
> import re, string
> import fpformat
>
> form = cgi.FieldStorage()
> width = form.getfirst('width')
> lines = '''
> #!/usr/bin/python
>
> return %s''' % width
> f = 'width.py'
> try:
> os.remove(f)
> except OSError:
> pass
> f = open(f, 'w')
> f.writelines(lines)
> f.close()
>
> Simple enough. Here's the permissions:
>
> drwxrwxrwx 31 root root 4096 Feb 23 04:57 ..
> -rwxrwxrwx 1 root root 390 Mar 1 05:52 preload.py
>
> All loaded up deliberately to try and get it to work. Here's the error:
>
> /var/www/html/globalsolutionsgroup.vi/preload.py
> 21 except OSError:
> 22 pass
> 23 f = open(f, 'w')
> 24 f.writelines(lines)
> 25 f.close()
> f = 'width.py', builtin open = <type 'file'>
> IOError: [Errno 13] Permission denied: 'width.py'
> args = (13, 'Permission denied')
> errno = 13
> filename = 'width.py'
> strerror = 'Permission denied'
>
> What'd I do wrong?
> TIA,
> beno
>
> --
> The Logos has come to bear
> http://logos.13gems.com/
>
--
The Logos has come to bear
http://logos.13gems.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100301/98fb78e6/attachment-0001.html>
More information about the Python-list
mailing list