[Python-Dev] Python 1.5.2 modules need porting to 2.0 because of unicode - comments please

Barry Scott barry@scottb.demon.co.uk
Tue, 19 Sep 2000 00:43:25 +0100


Mark's Python COM code is the source of unicode. I'm guessing that the old
1.5.2 support coerced to string and now that unicode is around Mark's
code gives me unicode strings. Our app is driving Microsoft visual
SourceSafe thru COM.

The offending line that upgraded all strings to unicode that broke mail:

file.write( 'Crit: Searching for new and changed files since label %s\n' % previous_source_label )

previous_source_label is unicode from a call to a COM object.

file is a StringIO object.

		Barry

> -----Original Message-----
> From: python-dev-admin@python.org [mailto:python-dev-admin@python.org]On
> Behalf Of Guido van Rossum
> Sent: 19 September 2000 00:45
> To: Barry Scott
> Cc: PythonDev
> Subject: Re: [Python-Dev] Python 1.5.2 modules need porting to 2.0
> because of unicode - comments please
> 
> 
> > I have managed to get all our critical python code up and
> > running under 2.0b1#4, around 15,000 lines. We use win32com
> > and wxPython extensions. The code drive SourceSafe and includes
> > a Web server that schedules builds for us.
> > 
> > The only problem I encounted was the problem of mixing string
> > and unicode types.
> > 
> > Using the smtplib I was passing in a unicode type as the body
> > of the message. The send() call hangs. I use encode() and all
> > is well.
> > 
> > Is this a user error in the use of smtplib or a bug?
> > 
> > I found that I had a lot of unicode floating around from win32com
> > that I was passing into wxPython. It checks for string and raises
> > exceptions. More use of encode() and we are up and running.
> > 
> > Is this what you expected when you added unicode?
> 
> Barry, I'm unclear on what exactly is happening.  Where does the
> Unicode come from?  You implied that your code worked under 1.5.2,
> which doesn't support Unicode.  How can code that works under 1.5.2
> suddenly start producing Unicode strings?  Unless you're now applying
> the existing code to new (Unicode) input data -- in which case, yes,
> we expect that fixes are sometimes needed.
> 
> The smtplib problem may be easily explained -- AFAIK, the SMTP
> protocol doesn't support Unicode, and the module isn't Unicode-aware,
> so it is probably writing garbage to the socket.
> 
> --Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)
> 
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://www.python.org/mailman/listinfo/python-dev
>