TypeError
Victor Subervi
victorsubervi at gmail.com
Wed Jan 6 02:11:31 EST 2010
Hi;
I get this error:
/var/www/html/angrynates.com/christians/cart/simplemail/mail.py
153 </head>
154 <body>'''
155 commitSale()
156 myMail()
157 print '''
commitSale = <function commitSale>
/var/www/html/angrynates.com/christians/cart/simplemail/mail.py in
commitSale()
98 cursor.execute('select max(ID) from %sCustomerData;' % store)
99 custID = cursor.fetchone()[0]
100 customerData(store, tmpTable, custID, patientID)
101
102 def myMail():
global customerData = <function customerData>, global store = 'products',
tmpTable = 'tem12627568064', custID = 1, global patientID = 'None'
/var/www/html/angrynates.com/christians/cart/customerData.py in
customerData(store='products', tmpTable='tem12627568064', custID=1,
patientID='None')
39 <body>
40 """
41 print """
42 print '<h1 align="center">%s Customer Data</h1>' % (store[0].upper()
+ store[1:])
43 cursor.execute('describe %sCustomerData' % store)
store = 'products'
ValueError: unsupported format character '(' (0x28) at index 54
args = ("unsupported format character '(' (0x28) at index 54",)
Apparently that character is a "file separator", which I presume is an
invisible character. I tried retyping the area in question, but with no
avail (threw same error). Please advise. Complete code follows.
TIA,
beno
#!/usr/bin/python
import sys,os
sys.path.append(os.getcwd())
import MySQLdb
from login import login
import re, string
def customerData(store, tmpTable, custID, patientID):
user, passwd, db, host = login()
db = MySQLdb.connect(host, user, passwd, db)
cursor = db.cursor()
page= """#!/usr/bin/python
import sys,os
sys.path.append(os.getcwd())
import MySQLdb
from login import login
import re, string
from particulars import ourStores, ourOptions
import fpformat
from sets import Set
from processOrder import processOrder
def %sCustomerData():
print 'Content-Type: text/html'
print
print '''
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<head xmlns="http://www.w3.org/1999/xhtml">
<style type='text/css'>
.text { font-family: Arial, Helvetica, sans-serif; font-size: 16px;
text-decoration: none; text-align: justify}
</style>
<title></title>
<meta http-equiv="distribution" content="Global" />
<meta http-equiv="robots" content="index all, follow all" />
<meta name="author" content="This web site developed by beno. You may reach
him at his web site [beno.vi], or by dialing 340-773-0687 and asking for
room 102." />
</head>
<body>
"""
print """
print '<h1 align="center">%s Customer Data</h1>' % (store[0].upper() +
store[1:])
cursor.execute('describe %sCustomerData' % store)
cols = [itm[0] for itm in cursor]
cursor.execute('select * from %sCustomerData where ID=%s' % (store,
custID))
ourCustomerData = cursor.fetchone()
ourColsAndCustomerDataDict = dict(zip(cols, ourCustomerData))
for col, data in ourColsAndCustomerDataDict.iteritems():
print '<b>%s</b>: %s<br />' % (col, data)
print "<br /><h2 align='center'>Customer Order</h2>"
print "<table border='1'>\n <tr>"
numberShippingFields, totalTotal, html = processOrder(patientID, store,
tmpTable)
print html
print " </tr>"
if store != 'prescriptions':
numberCols = 12 + numberShippingFields
else:
numberCols = 8 + numberShippingFields
print ' <tr>\n <td colspan="%d"><b>TOTAL</b></td>\n
<td><b>$%s</b></td>\n </tr>' % (numberCols - 1,
str(fpformat.fix(round(int(totalTotal * 100))/100,2)))
print "</table>"
cursor.close()
print '''
</body>
</html>
'''
%sCustomerData()
""" % (store, store)
os.chdir('..')
try:
os.delete('%s/%sCustomerData.py' % (os.getcwd(), store))
except AttributeError:
pass
file = '%sCustomerData.py' % store
f = open(file, 'w')
f.write(page)
f.close()
# os.chown('%s/%s' % (os.getcwd(), file), 500, 500)
os.chmod('%s/%s' % (os.getcwd(), file), 0755)
--
The Logos has come to bear
http://logos.13gems.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100106/b2b9690b/attachment.html>
More information about the Python-list
mailing list