Hi,

1st of all: Thank you very much for the fast answers to my last problems.

So, to get rid of problems, I "reimplemented" so functions, using 
import win32file. But following does not work:

>>> win32file.FindFilesW(dir + '/*.*')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
UnicodeError: ASCII encoding error: ordinal not in range(128)
>>>

while 'dir' contains any UNICODE character...

Is there any work around?


My solution is to use microsoft visual basic scripting. A small
example, which works fine, but is very, very slow:

#---------------------------------------------------------------
import win32api
import win32com.client

fso = win32com.client.Dispatch("Scripting.FileSystemObject")

def listdir(path):
  try:
    retCode = []
    folder = fso.GetFolder(path)
    for f in folder.Files:
      retCode.append(f.Name)
    for d in folder.SubFolders:
      retCode.append(d.Name)
  except pywintypes.com_error:
    import win32api
    s = win32api.FormatMessage(3)
    s = "[Errno 3] %s: '%s\\*.*'" % (s[:s.index('.\r\n')], path)
    raise WindowsError, s
  return retCode
#---------------------------------------------------------------

Regards/Mir freundlichen Grüßen
Werner Merkl

--
----------------------------------------------------------------------
Werner Merkl
Senior Engineer Software Pre-Installation
FSC VP BP RD PI 
Fujitsu Siemens Computers
Buergermeister-Ulrich-Str. 100
86199 Augsburg
Germany

Telephone:      +49(0)821 804-3548
Telefax:        +49(0)821 804-3835
E-mail: mailto: [EMAIL PROTECTED]
Internet:       http://www.fujitsu-siemens.com
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to