[Tutor] SYS Long File Names?

Tim Golden mail at timgolden.me.uk
Sun Feb 7 15:10:40 CET 2010


On 06/02/2010 21:36, FT wrote:
>      I was looking at the sys.argv(1) file name and it is the short 8 char
> name. How do you place it into the long file name format? I was reading
> music files and comparing the name to the directory listing and always comes
> back as not found because the name was shortened.

I'm assuming you're on Windows (because I don't
think *nix has a long/short-name concept). I've
never seen sys.argv return an 8.3 name, but taking
your word for it:

<code>
import win32api

print win32api.GetLongPathName ("eight.thr")

</code>

If you don't have the pywin32 packages installed
(and you don't want to) then you can do the same
using ctypes by accessing the kernel32 DLL:

http://msdn.microsoft.com/en-us/library/aa364980%28VS.85%29.aspx

TJG


More information about the Tutor mailing list