Windows: open() -> "[Errno 38] Filename too long"

Discussion in 'Python' started by robert, Jun 24, 2009.

  1. robert

    robert Guest

    When doing open/os.stat/...(dirpath+filename)
    and total path > 250 chars then

    OSError: "[Errno 38] Filename too long"

    is there a way to access the file without changing to that
    directory (its in a thread and a fast iteration of many file too) ?
    robert, Jun 24, 2009
    #1
    1. Advertising

  2. robert

    Tim Golden Guest

    robert wrote:
    > When doing open/os.stat/...(dirpath+filename)
    > and total path > 250 chars then
    >
    > OSError: "[Errno 38] Filename too long"
    >
    > is there a way to access the file without changing to that directory
    > (its in a thread and a fast iteration of many file too) ?


    Change filename

    r"c:\temp\long.txt"

    to

    ur"\\?\c:\temp\long.txt"


    TJG
    Tim Golden, Jun 24, 2009
    #2
    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. Shilpa
    Replies:
    1
    Views:
    6,042
    Anubhav Jain
    Mar 22, 2006
  2. THY
    Replies:
    4
    Views:
    511
    Gönen EREN
    Aug 22, 2003
  3. RJN
    Replies:
    2
    Views:
    4,900
  4. TC
    Replies:
    3
    Views:
    3,287
  5. Replies:
    1
    Views:
    248
Loading...

Share This Page