Hi;<br>I have the following code:<br><br>          if 13 < x < 20:<br>            y += 1<br>            w += 1<br>            try:<br>              getpic = "getpic" + str(w) + ".py"<br>              try:<br>
                os.remove(getpic)<br>              except:<br>                pass<br>              code = """#! /usr/bin/python<br>import cgitb; cgitb.enable()<br>import MySQLdb<br>import cgi<br>import sys,os<br>
sys.path.append(os.getcwd())<br>from login import login<br>def pic():<br>  user, passwd, db, host = login()<br>  form = cgi.FieldStorage()<br>  db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db)<br>  cursor= db.cursor()<br>
  sql = "select pic%s from productsX where id=%s;"<br>  cursor.execute(sql)<br>  content = cursor.fetchone()[0]<br>  cursor.close()<br>  print content<br>print 'Content-type: image/jpeg'<br>print<br>pic()<br>
print '</body></html>'""" % (str(w), str(w))<br>              script = open(getpic, "w")<br>              script.write(code)<br>              print '<td><input type="hidden" name="%s" />\n' % str(x)<br>
              print '<img src="%s"><br /><br /></td>\n' % (getpic)<br>              os.chmod(getpic, 755)<br>              count2 += 1<br>            except:<br>              pass<br>
<br>Forgive the empty except :) The problem is that the os.chmod command doesn't work. It's obviously in the right directory, because the script correctly writes there. What do?<br><br>On another note, I find it interesting that the above revised code does in fact get that darned image to finally post correctly. It appears that this python server insists on my calling a function...that I can't simply code it out without defining a function. Never run into that before.<br>
TIA,<br>Victor<br>