Python20 does'nt work in a DOS-Box

Wester wester at ilt.fhg.de
Thu Sep 28 03:24:38 EDT 2000


Fredrik Lundh wrote:

> Wester wrote:
> > I installed Python2.0b2. When I start it in a DOS-Box following happens:
> >
> > >>> import sys <RET>
> >    File "<stdin>", line 1
> >    import sys
> >                   ^
> > SystaxError: invalid syntax
> > >>>
>
> SystaxError?  did you cut and paste that error message?
>
> if not, maybe you accidentally typed space (or tab) before the
> "import" statement:
>
>     >>>  import sys
>       File "<stdin>", line 1
>         import sys
>         ^
>     SyntaxError: invalid syntax
>     >>>
>
> </F>

Sorry, of course it's "Syntax Error".
There was no space before import. When I type a space before
import I get the same error message, but the ^ sign is at the "i" of import
and not behind "sys".  I also have
Python 1.5.2 installed. I never had problems with python in a DOS-box. But
mysteriously after installing
Python 2.0b2 I get the same error message with Python 1.5.2. Things are O.K.
when using PythinWin or the
IDL-shell, so I can work with Python. Nevertheless I would also like to be
able to use a DOS-box.

I tried a little C++-program:

main()
{
     char c[3];
     int i;
     for(i=0; i < 3; i++) c[i] = 0;
     for(i=0; i < 3; i++)
     {
          cin.read(&c[i],1);
          cout << c[i] << "  " << int(c[i]) << endl;
     }
}
When I type "a<RET>" I get:
a   97

  10

There is only a LF but no CR LF as I expected under Windows. Is it possible
that python expects CR LF?


Rolf




More information about the Python-list mailing list