On Sat, 27 Aug 2005 23:30:46 +0000, Neil Hodgson wrote: > Kevin Ollivier: > >> On Windows, it's very common to have a string of long directories in the >> pathname for files, like "C:\Documents and Settings\My Long User Name\My >> Documents\My Long Subdirectory Name\...". For a wxPython application I'm >> working on, this has actually caused me to run into what appears to be >> Python's pathname length limit for opening files. (247 chars on Win) Yes, >> I can hear people saying "yipes!" but this stuff does happen sometimes on >> Windows. :-) > > The Win32 API restricts path arguments to 260 characters. Longer > paths can be passed to wide character functions by using a "\\?" prefix. > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/naming_a_file.asp > This may work from Python although I haven't tested it. > >> My first inclination was to use win32api.GetShortPathName(mypath), >> ... >> Looking at the pyWin32 sources, it does look like only the ASCII version >> of this function exists, which suggests that for now this route is a >> dead-end. > > All APIs can be accessed through ctypes.
Thanks for the tips! I had heard of ctypes but it never crossed my mind it was for accessing functions from shared libraries. :-) I'll try both of your tips out, and one of them should resolve the problem. Kevin > Neil -- http://mail.python.org/mailman/listinfo/python-list