Python ActiveX Scripting Engine raising Unicode errors

Steve Holden sholden at holdenweb.com
Wed Jan 17 03:56:24 EST 2001


Wonder if anyone can shed any light on this.

I'm processing a web form in Python  in the ASP environment, building a SQL
statement from the form content.

The first problem I'm having is that applying str() to empty form fields
seems to yield "None" rather than the empty string, which is slightly weird.
But apart from that things seem to happen OK until I get to a <textarea>. On
some database rows but not others I get the following traceback (de-mangled
to remove HTML encodings):

Traceback (innermost last):
  File ";<;Script Block >;";, line 10, in ?
    Stmt = pySQL.SQLUpdate(Request.Form, ";StdPage";, ((";Name";,";S";),),
(KeyVal,), Flist, ";";)
  File ";d:\steve\projects\python\pySQL.py";, line 53, in SQLUpdate
    Vl = Vl + ";'"; + pyLib.SQLesc(str(Form(f.FieldName))) + ";'";
  File ";d:\python20\win32com\client\dynamic.py";, line 165, in __str__
    return str(self.__call__())
UnicodeError: ASCII encoding error: ordinal not in range(128)
</font>
<p>
<font face="Arial" size=2>?</font>
<pre>return str(self.__call__())</pre>

As near as I can tell, the problem seems to be realted to taking the str()
of a long form field inside pySQL.py. By the time the error occurs,
apparently several <input type="text"> fields have already been successfully
handled.

On a related note, there is no pySQL.pyc anywhere on disk, and I'm wondering
if that's related.

regards
 Steve

--
Tools, training and technology to help you meet your information needs





More information about the Python-list mailing list