Where's split gone?

Dale Strickland-Clark dale at out-think.NOSPAMco.uk
Thu Oct 5 07:42:08 EDT 2000


Top man!

That was the answer. The ASP code was passing something that wasn't
quite a string!

Thanks.


scarblac at pino.selwerd.nl (Remco Gerlich) wrote:

>Dale Strickland-Clark <dale at out-think.NOSPAMco.uk> wrote in comp.lang.python:
>> The scene: Win32 (Win98 or Win2000), Python 1.6, IIS or PWS
>> 
>> I have a COM object written in Python. If I call it from VBScript or
>> JScript in Windows, it works.
>> 
>> However, if I call it from an ASP script running under PWS or IIS - on
>> the same machine, it fails with the following:
>> 
>> Python COM Server Internal Error error '80004005' 
>> Unexpected Python Error: exceptions.AttributeError: split 
>> 
>> The only 'split' in the source is a call to the on in the string
>> module - yet a little earlier in the same code, I call string.join
>> without grief.
>> 
>> What might be the problem here?
>
>In 1.6, join and split are string methods. The versions in the string
>module just call the string method like:
>
>def split(s, sep=" "):
>   return s.split(sep)
>   
>def join(l, sep=" "):
>   return sep.join(l)
>
>(see the library source)
>
>Now if your string isn't a real string but some string-like object, it might
>not have the .split() method, and therefore string.split will fail, with
>that AttributeError.
>string.join, on the other hand, calls the method on the separator, and that
>is a string.
>
>Is my guess.

Dale Strickland-Clark
Out-Think Ltd
Business Technology Consultants





More information about the Python-list mailing list