RE: file names longer than MAX_PATH under Windows 2003

Discussion in 'Python' started by Tim Golden, Feb 14, 2006.

  1. Tim Golden

    Tim Golden Guest

    [Sergey]

    | "Tim Golden" <> wrote in
    | message news:...
    | [Sergey]
    |
    | >Not to state the obvious, but can you cut-and-paste that long
    | >string (the one starting with \\?\e:\...) from the Python
    | >interpreter into the tart [R]un [O]pen field to see what
    | >comes up? I'm just trying to make sure of the most straightforward
    | >fact: that the file you've got there definitely does exist!
    |
    | I cannot do this: when I paste filename there, trail of
    | filename is missing due to length limit in input line.
    | But I strongly suppose that file exists as its name was get
    | through os.listdir.

    I see from another post that CreateFile cannot open your file.
    That puts it further away from Python, although it doesn't
    explain how some other program can see the files. Can you use
    os.startfile (or its equivalent win32api.ShellExecute from
    pywin32)? Perhaps if you were to chdir to the directory in
    question you'd be able to access the file.

    Don't know really; clutching at straws.

    TJG

    ________________________________________________________________________
    This e-mail has been scanned for all viruses by Star. The
    service is powered by MessageLabs. For more information on a proactive
    anti-virus service working around the clock, around the globe, visit:
    http://www.star.net.uk
    ________________________________________________________________________
     
    Tim Golden, Feb 14, 2006
    #1
    1. Advertising

  2. Tim Golden

    Sergey Guest

    "Tim Golden" <> wrote in message news:...
    [Sergey]

    >I see from another post that CreateFile cannot open your file.
    >That puts it further away from Python, although it doesn't
    >explain how some other program can see the files. Can you use
    >os.startfile (or its equivalent win32api.ShellExecute from
    >pywin32)? Perhaps if you were to chdir to the directory in
    >question you'd be able to access the file.


    I found error in filename (extra backslash) and now I can open file.
    But another trouble appeared: I cannot listdir so long name.
    I examined posixmodule.c... There are wcsncpy with hard limit of MAX_PATH*2+5.
    So... RIP, my module...
     
    Sergey, Feb 15, 2006
    #2
    1. Advertising

  3. Sergey wrote:
    > "Tim Golden" <> wrote in message news:...
    > [Sergey]
    >
    >
    >>I see from another post that CreateFile cannot open your file.
    >>That puts it further away from Python, although it doesn't
    >>explain how some other program can see the files. Can you use
    >>os.startfile (or its equivalent win32api.ShellExecute from
    >>pywin32)? Perhaps if you were to chdir to the directory in
    >>question you'd be able to access the file.

    >
    >
    > I found error in filename (extra backslash) and now I can open file.
    > But another trouble appeared: I cannot listdir so long name.
    > I examined posixmodule.c... There are wcsncpy with hard limit of MAX_PATH*2+5.
    > So... RIP, my module...
    >
    >

    I don't know if and how it apply and can be of any help here, but in my
    C programs in the very past after switching from DOS to Windows long
    names a following trick solved often my problems with too long names:
    step 1: setting the current directory to the beginning part of the
    name with a length which can be passed as a function parameter
    step 2: usage of the remaining part of name as name passed as
    parameter to the file accessing function (relative to current directory)

    Claudio
     
    Claudio Grondi, Feb 15, 2006
    #3
  4. Tim Golden

    Sergey Guest

    "Claudio Grondi" <> wrote in message news:dsvims$gps$...
    > Sergey wrote:
    > I don't know if and how it apply and can be of any help here, but in my C programs in the very past after switching from DOS to
    > Windows long names a following trick solved often my problems with too long names:
    > step 1: setting the current directory to the beginning part of the name with a length which can be passed as a function
    > parameter
    > step 2: usage of the remaining part of name as name passed as parameter to the file accessing function (relative to current
    > directory)


    It seems this method doesn't help here.
     
    Sergey, Feb 15, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sunner Sun
    Replies:
    23
    Views:
    9,443
    Dan Pop
    Apr 13, 2004
  2. Sergey
    Replies:
    4
    Views:
    4,156
    Sergey
    Feb 14, 2006
  3. Tim Golden
    Replies:
    2
    Views:
    324
    Sergey
    Feb 14, 2006
  4. Tim Golden
    Replies:
    2
    Views:
    347
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Feb 15, 2006
  5. sonet

    How to change MAX_PATH value?

    sonet, Nov 28, 2007, in forum: Perl Misc
    Replies:
    2
    Views:
    514
    Ilya Zakharevich
    Dec 4, 2007
Loading...

Share This Page