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 <victorsube...@gmail.com>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 <mahle...@yahoo.com>wrote:
>
>>  >From: Victor Subervi <victorsube...@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
>>
>>
>
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to