Date: Fri, 9 Oct 2009 10:20:56 -0500 From: Victor Subervi <victorsubervi@gmail.com> To: mahlerrd@yahoo.com, freebsd-questions@freebsd.org Subject: Re: Automatic chmod Message-ID: <4dc0cfea0910090820i4aa1c7e8ia9512d2cd2fde9bb@mail.gmail.com> In-Reply-To: <868054.78039.qm@web51006.mail.re2.yahoo.com> References: <4dc0cfea0910090719s36c43d89q124c3aa0923d629a@mail.gmail.com> <868054.78039.qm@web51006.mail.re2.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
User? I only have one user on this shared server. Here's the code: #!/usr/local/bin/python import cgitb; cgitb.enable() import MySQLdb import cgi import sys,os sys.path.append(os.getcwd()) from login import login user, passwd, db, host = login() form = cgi.FieldStorage() picid = int(form['id'].value) x = int(form['x'].value) pics = {1:'pic1',2:'pic2',3:'pic3',4:'pic4',5:'pic5',6:'pic6'} pic = pics[x] db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db) cursor= db.cursor() sql = "select " + pic + " from productsX where id='" + str(picid) + "';" cursor.execute(sql) content = cursor.fetchall()[0][0].tostring() cursor.close() print '''Content-Type: text/plain Content-Encoding: base64 ''' print print content.encode('base64') TIA, V On Fri, Oct 9, 2009 at 10:14 AM, Richard Mahlerwein <mahlerrd@yahoo.com>wrote: > >From: Victor Subervi <victorsubervi@gmail.com> > >Subject: Automatic chmod > >To: freebsd-questions@freebsd.org > >Date: Friday, October 9, 2009, 10:19 AM > > > >Hi; > >I have a python script that automatically writes another script. I need to > >be able to automatically chmod the script so that it will execute. Also, > it > >appears that's not enough, because when I manually chmod the script (775), > >it throws this error: > >fopen: Permission denied > >TIA, > >V > > What user are you running this under? Without seeing code, my first guess > is that you are trying to open a file you don't have permission to open. > The chmod you are doing only affects the script's permissions, not the > permissions of the files it may touch. > > For more, I suggest posting the code itself. > > -Rich > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4dc0cfea0910090820i4aa1c7e8ia9512d2cd2fde9bb>