glob.glob unicode bug or feature

Neil Hodgson nhodgson at bigpond.net.au
Sat Jul 31 18:27:40 EDT 2004


Peter Otten:

> The information whether glob() was passed a unicode or str is lost in the
> following line in glob.glob1():
>
> if not dirname: dirname = os.curdir
>
> A quick fix would be
>
> if not dirname:
>     dirname = type(dirname)(os.curdir)

   This didn't work for me as os.curdir has already been added in the call
to glob1. Instead, for Python 2.3, also changing line 22 inside glob() to

        return glob1(type(dirname)(os.curdir), basename)

   worked.

   Neil





More information about the Python-list mailing list