help! - cmd line interpreter gone "dumb"

Discussion in 'Python' started by Tim, Jul 6, 2003.

  1. Tim

    Tim Guest

    Maybe I've been working too long, but has anyon had their python interpreter
    stop taking commands.

    The IDLE version works fine, but under Windoze:

    1) execute "python" in teh command shell
    2) ...interpreter comes up fine
    3) type in anything and you get "SyntaxError: invalid syntax"

    Literally, you could type in "import sys" or anything common and you get the
    same results.

    Any help greatly appreciated--thanks.

    Tim
     
    Tim, Jul 6, 2003
    #1
    1. Advertising

  2. Tim

    Tim Guest

    Yes, reboot or have the programmer give his head a shake. ;-)

    I love this language, but getting used to the little set up details I
    guess...Half of it was my own ignorance, but it's not obvious.

    For the record...

    if I don't define any paths for Python, it naturally knows were to go for
    the core + libraries.
    but, if you define the PYTHONPATH in the environment--only those directories
    are searched. It was probably the late night that had me forget when I
    changed things (funny--its seemed to work for a long while, but the changes
    may not have been reflected if I had the same command window open the entire
    evening (this was the case, I think).

    It makes sense...

    Tim



    "Gerhard Häring" <> wrote in message
    news:...
    > Tim wrote:
    > > Maybe I've been working too long, but has anyon had their python

    interpreter
    > > stop taking commands.
    > >
    > > The IDLE version works fine, but under Windoze:
    > >
    > > 1) execute "python" in teh command shell
    > > 2) ...interpreter comes up fine
    > > 3) type in anything and you get "SyntaxError: invalid syntax"
    > >
    > > Literally, you could type in "import sys" or anything common and you get

    the
    > > same results.

    >
    > I've seen that when I used os.spawn* (or was it os.execv*?), apparently
    > in a wrong way.
    >
    > > Any help greatly appreciated--thanks.

    >
    > Typical Windows answer: reboot and try again ;-)
    >
    > -- Gerhard
    >
     
    Tim, Jul 7, 2003
    #2
    1. Advertising

  3. Tim

    Peter Hansen Guest

    Tim wrote:
    >
    > For the record...
    >
    > if I don't define any paths for Python, it naturally knows were to go for
    > the core + libraries.
    > but, if you define the PYTHONPATH in the environment--only those directories
    > are searched. It was probably the late night that had me forget when I
    > changed things (funny--its seemed to work for a long while, but the changes
    > may not have been reflected if I had the same command window open the entire
    > evening (this was the case, I think).


    This wasn't likely the cause of all your problems. Try defining
    that environment variable again, and check whether "import sys"
    really does give a syntax error. If it does, it's something else,
    because all PYTHONPATH should do is let you add more stuff to
    the standard search path. (If you can get import sys to work,
    type "sys.path" to see what is defined, and you'll see that the
    stuff in PYTHONPATH merely goes at the front, just after the ''
    item which means the directory from which the script runs.)

    If you are really getting a syntax error, paste the full traceback
    into another posting so we can see what it is. Maybe you were
    typing with CAPSLOCK on? Or you had a module of your own in the
    current directory, called sys.py, and it contained a syntax error,
    so when you imported it you got confused? Definitely something
    other than PYTHONPATH, I think.

    -Peter
     
    Peter Hansen, Jul 7, 2003
    #3
    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. Achim Domma (Procoders)

    read input for cmd.Cmd from file

    Achim Domma (Procoders), Jun 3, 2005, in forum: Python
    Replies:
    2
    Views:
    8,084
    Peter Otten
    Jun 3, 2005
  2. Sarir Khamsi

    Interpreter-like help in cmd.Cmd

    Sarir Khamsi, Jun 9, 2005, in forum: Python
    Replies:
    4
    Views:
    380
    Bengt Richter
    Jun 26, 2005
  3. =?ISO-8859-1?Q?Sch=FCle_Daniel?=

    [exec cmd for cmd in cmds]

    =?ISO-8859-1?Q?Sch=FCle_Daniel?=, Mar 8, 2006, in forum: Python
    Replies:
    3
    Views:
    393
    Scott David Daniels
    Mar 8, 2006
  4. Diez B. Roggisch

    pydb remote debugging/cmd.Cmd over socket?

    Diez B. Roggisch, May 28, 2008, in forum: Python
    Replies:
    2
    Views:
    552
    Diez B. Roggisch
    May 29, 2008
  5. Jerry C.
    Replies:
    8
    Views:
    252
    Uri Guttman
    Nov 23, 2003
Loading...

Share This Page