running python on xp command prompt

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TPhung@lbl.gov

    #1

    running python on xp command prompt

    Hi,

    I have a simple question about running python on windows xp command
    prompt. The file is as follows and is named spam.py:

    print 2**8
    print 'the bright side' + 'of life'
    print "hello world"

    I run this on the command prompt as follows

    C:\Documents and Settings\User>p ython C:\Documents and Settings\User
    \Desktop\spa
    m.py
    python: can't open file 'C:\Documents': [Errno 2] No such file or
    directory

    and get the error above. If I surround the second directory in quotes
    like this

    C:\Documents and Settings\User>p ython "C:\Documen ts and Settings\User
    \Desktop\spa
    m.py"

    , there is no error. Does anyone know why this is.

    Thank you

  • Steve  Potter

    #2
    Re: running python on xp command prompt

    On Mar 17, 2:15 pm, TPh...@lbl.gov wrote:
    Hi,
    >
    I have a simple question about running python on windows xp command
    prompt. The file is as follows and is named spam.py:
    >
    print 2**8
    print 'the bright side' + 'of life'
    print "hello world"
    >
    I run this on the command prompt as follows
    >
    C:\Documents and Settings\User>p ython C:\Documents and Settings\User
    \Desktop\spa
    m.py
    python: can't open file 'C:\Documents': [Errno 2] No such file or
    directory
    >
    and get the error above. If I surround the second directory in quotes
    like this
    >
    C:\Documents and Settings\User>p ython "C:\Documen ts and Settings\User
    \Desktop\spa
    m.py"
    >
    , there is no error. Does anyone know why this is.
    >
    Thank you
    It is because of the spaces in the path. The command prompt assumes
    that when it encounters a space that is the end of the attribute. By
    surrounding it in quotes you are indicating that it is all one
    attribute.


    Steve

    Comment

    Working...