TypeError: coercing to Unicode: need string or buffer, instance found

S

Stuart Forsyth

What can I do about this error, i am tearing my hair out!

Python ActiveX Scripting Engine (0x80020009)
Traceback (most recent call last): File "<Script Block >", line 58, in ?
FileContents =
FileContents.replace('Repl_learner',unicode(Request("learner"),'utf-8','igno
re')) TypeError: coercing to Unicode: need string or buffer, instance found

FileContents is defined as:

MasterFile = codecs.open(MasterFilePath, "r", "utf-8")
FileContents = MasterFile.read()

Please help !
 
V

vincent wehren

| What can I do about this error, i am tearing my hair out!
|
| Python ActiveX Scripting Engine (0x80020009)
| Traceback (most recent call last): File "<Script Block >", line 58, in ?
| FileContents =
|
FileContents.replace('Repl_learner',unicode(Request("learner"),'utf-8','igno
| re')) TypeError: coercing to Unicode: need string or buffer, instance
found
|
| FileContents is defined as:
|
| MasterFile = codecs.open(MasterFilePath, "r", "utf-8")
| FileContents = MasterFile.read()
|
| Please help !
|

You should inspect 'Request("learner")' more closely. It propbably doesn't
return an encoded string, but an instance of some sort...
I'm not really on board with ActiveX, but shouldn't you call some sort of a
method on Request to get a collection (e.g. Request.Form("learner")?

Regards,
Vincent Wehren
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top