FAQ
Hello

Here is my simple listdir example:
import os
os.listdir("C:\Python24\") # This directory relly exists
Here is my error:

WindowsError: [Errno 3] The system cannot find the path specified: 'l/
*.*'

Regards,
Vedran

Search Discussions

  • Jerry Hill at Aug 3, 2007 at 8:05 pm

    On 8/3/07, vedrandekovic at v-programs.com wrote:
    Hello

    Here is my simple listdir example:
    import os
    os.listdir("C:\Python24\") # This directory relly exists
    Here is my error:

    WindowsError: [Errno 3] The system cannot find the path specified: 'l/
    *.*'

    That's a somewhat surprising error. Under 2.5, I get a more helpful
    error message:
    import os
    os.listdir("C:\Python25\")
    SyntaxError: EOL while scanning single-quoted string

    That's because I've escaped the closing quote of the string with \".
    Use this instead:
    os.listdir("C:\\Python25\\")
    or
    os.listdir("C:/Python25/")
    since windows is usually happy to use forward slashes instead of
    backslashes in directory names.

    --
    Jerry
  • Kyosohma at Aug 3, 2007 at 8:06 pm

    On Aug 3, 2:50 pm, vedrandeko... at v-programs.com wrote:
    Hello

    Here is my simple listdir example:
    import os
    os.listdir("C:\Python24\") # This directory relly exists
    Here is my error:

    WindowsError: [Errno 3] The system cannot find the path specified: 'l/
    *.*'

    Regards,
    Vedran
    I get "SyntaxError: EOL while scanning single-quoted string", which is
    what should happen when you escape the double-quotes at the end. Not
    sure how you're getting that WindowsErrors.

    If I do os.listdir('c:\python24') instead, it works fine.

    Mike
  • Tim Roberts at Aug 5, 2007 at 1:46 am

    kyosohma at gmail.com wrote:
    I get "SyntaxError: EOL while scanning single-quoted string", which is
    what should happen when you escape the double-quotes at the end. Not
    sure how you're getting that WindowsErrors.

    If I do os.listdir('c:\python24') instead, it works fine.
    Yes, but only by accident. It will fail again if you try to do
    os.listdir('c:\tmp'). You need to use the right quoting.
    --
    Tim Roberts, timr at probo.com
    Providenza & Boekelheide, Inc.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedAug 3, '07 at 7:50p
activeAug 5, '07 at 1:46a
posts4
users4
websitepython.org

People

Translate

site design / logo © 2022 Grokbase