help with file path exceeding 255 characters

John Machin sjmachin at lexicon.net
Tue May 13 18:31:04 EDT 2008


yguan08 at gmail.com wrote:
> On May 13, 4:38 pm, John Machin <sjmac... at lexicon.net> wrote:
>> ygua... at gmail.com wrote:
>>> I have trouble of obtaining the file size of a file because the
>>> fullpath exceeds 255 characters. I get this message with
>> At the DOS command level, you can do
>>      subst x: very\long\path
>> and then refer to
>>      x:filestem.ext
>> where x is any unused drive letter.
> Good idea. But subst does not see to work with path that has spaces.
> It gives "Incorrect number of parameters"

If any DOS command-line argument includes spaces, you need to quote it.

os.system(r'subst x: "c:\my big fat path\rab oof\etc etc etc"')




More information about the Python-list mailing list