From owner-freebsd-questions@FreeBSD.ORG Fri Oct 9 15:26:36 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 C9AB9106566B for ; Fri, 9 Oct 2009 15:26:36 +0000 (UTC) (envelope-from victorsubervi@gmail.com) Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.24]) by mx1.freebsd.org (Postfix) with ESMTP id 833A68FC0A for ; Fri, 9 Oct 2009 15:26:36 +0000 (UTC) Received: by qw-out-2122.google.com with SMTP id 3so564573qwe.7 for ; Fri, 09 Oct 2009 08:26:35 -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=IHWAB1oVV0aEoiV5jLBJ1Jqw5U/OZ0mfPbQfwzRIcrA=; b=rpNnfWSrutYsMxA5XdIf+hsZxXxLdFIUt+dWO1Me+9S7q5I4mfVyV1hRxZATNw9eAX 78nF//zAbXK72EdH4qu66Brng5admW4up4/g7n9B9/E+iPbo3H++RHN6e0kvE3Af/FCf wi68xrUBX9bIJdH701MvYjOERCgvArHsrmhKE= 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=fFDchtw+cFVLsX9Ijk58PTmF+Puhvj2mYhdoQ8UOvtq4xpQc5nO2aFf4L0eqwYL4VN peta/8KWwfQZJ1GB9//svq/Lf4PLarb7lz+NGj0jOFFP+ZO2XijXDEhySkX7HL+wuFUF KRUnCtEWa/cu5Iv84+Nc+X8NHoU5cXmuseMwM= MIME-Version: 1.0 Received: by 10.229.37.74 with SMTP id w10mr1541034qcd.73.1255101995491; Fri, 09 Oct 2009 08:26:35 -0700 (PDT) In-Reply-To: <4dc0cfea0910090820i4aa1c7e8ia9512d2cd2fde9bb@mail.gmail.com> References: <4dc0cfea0910090719s36c43d89q124c3aa0923d629a@mail.gmail.com> <868054.78039.qm@web51006.mail.re2.yahoo.com> <4dc0cfea0910090820i4aa1c7e8ia9512d2cd2fde9bb@mail.gmail.com> Date: Fri, 9 Oct 2009 10:26:35 -0500 Message-ID: <4dc0cfea0910090826o423f21d1t2617593dc358dc74@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:26:36 -0000 I should have mentioned the import of the login works for other scripts, so that is not the issue. V On Fri, Oct 9, 2009 at 10:20 AM, Victor Subervi wrote: > 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 >> >> >