Bug in win32file.FindFilesW ?

Werner Merkl werner.merkl at fujitsu-siemens.de
Fri Nov 29 03:34:52 EST 2002


Mark,

first of all thank you for you quick response.

"Mark Hammond" <mhammond at skippinet.com.au> wrote in message
news:ZRvF9.25390$hg1.68955 at news-server.bigpond.net.au...
> Werner Merkl wrote:
> >
> >>>>f.FindFilesW(dir)
> >
> > Traceback (most recent call last):
> >   File "<interactive input>", line 1, in ?
> > UnicodeError: ASCII encoding error: ordinal not in range(128)
>
> You will find that this is simply the error from *printing* the result,
> not from the operation.
>
> l = f.FindFilesW(dir)
>
> should work fine, and each element of 'l' should have a unicode
> character - but attempting to print ones with Unicode characters may fail.

ehm... I get the same error. It seems to be an error INSIDE win32file...

[d:\projects\test\findfilew]python test.py
Traceback (most recent call last):
  File "test.py", line 7, in ?
    l = f.FindFilesW(dir)
UnicodeError: ASCII encoding error: ordinal not in range(128)

This was on a Windows 2000 German.

> > !!!! BTW: ">>> f.SetCurrentDirectory(dir)" brings also an ERROR!!!!
>
> What error?
Because  I'm not sure, whether german is well known language here
I ran the same program on an XP Professional English:

[A]python
Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ^Z


[A]python test.py
Traceback (most recent call last):
  File "test.py", line 7, in ?
    l = f.FindFilesW(dir)
UnicodeError: ASCII encoding error: ordinal not in range(128)

###
### Following is the result with line 7 commented out
###
[A]python test.py
Traceback (most recent call last):
  File "test.py", line 9, in ?
    f.SetCurrentDirectory(dir)
pywintypes.error: (123, 'SetCurrentDirectory', 'The filename, directory
name, or volume label syntax is incorrect.')

Again, thank you in advance
Werner


test.py:
----------------------------------------------------------------------------
-------------------
dir = u'\u03b1\u03b2\u03b3.DIR'
import win32file as f
f.CreateDirectoryW(dir, None)
from os.path import join as j
f.CreateFileW(j(dir,'1'),0,0,None,f.CREATE_NEW,0,None)
f.CreateFileW(j(dir,'2'),0,0,None,f.CREATE_NEW,0,None)
l = f.FindFilesW(dir)

f.SetCurrentDirectory(dir)





More information about the Python-list mailing list