From owner-freebsd-questions@FreeBSD.ORG Fri Oct 9 15:20:57 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6F361065672 for ; Fri, 9 Oct 2009 15:20:57 +0000 (UTC) (envelope-from victorsubervi@gmail.com) Received: from mail-qy0-f195.google.com (mail-qy0-f195.google.com [209.85.221.195]) by mx1.freebsd.org (Postfix) with ESMTP id 8F4A98FC13 for ; Fri, 9 Oct 2009 15:20:57 +0000 (UTC) Received: by qyk33 with SMTP id 33so7100749qyk.29 for ; Fri, 09 Oct 2009 08:20:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=QryutWt93/FLOiGY1ND2rjtm3tvalZi7LiwVnXwbC+M=; b=f4aVUshdgoctALgoWuOm8IbN5guzFgKAO1Tr9T96XZR1/rl00o2nDOmuhKbVgRgzzj SZ62cgHD6D23MiNYkEsTthccqmeBwnsl5fGTftVkFXGwC9mwcOq58LNq7dNSKmlggv7k mkdM5co26U6EebZTb81q1yfIWG8kZDCSJqmpM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=qbsXT6cVwjvS4LGzkUV3Ke/nAEs1H4A0XbxMwbcAz6uCfJd6eW5Ofdedbh3Gr1Asz7 nLoAmFRtwWIWZEmDLtRtvm+DvGHcCq51HMG9H7gR55VFEW/212hDLSLFy5KlIOn0BvSJ dwiOswcTKAA9YU4RuCzAmq3hmzTlpdv5SEEow= MIME-Version: 1.0 Received: by 10.229.62.89 with SMTP id w25mr432289qch.6.1255101656601; Fri, 09 Oct 2009 08:20:56 -0700 (PDT) In-Reply-To: <868054.78039.qm@web51006.mail.re2.yahoo.com> References: <4dc0cfea0910090719s36c43d89q124c3aa0923d629a@mail.gmail.com> <868054.78039.qm@web51006.mail.re2.yahoo.com> Date: Fri, 9 Oct 2009 10:20:56 -0500 Message-ID: <4dc0cfea0910090820i4aa1c7e8ia9512d2cd2fde9bb@mail.gmail.com> From: Victor Subervi To: mahlerrd@yahoo.com, freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: Automatic chmod X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2009 15:20:57 -0000 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 wrote: > >From: Victor Subervi > >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 > >