redirecting Stdin

Fredrik Lundh fredrik at pythonware.com
Wed Dec 3 06:47:49 EST 2003


Jon Arter wrote:

> This results in a parsing error when the file reading reaches the
>  def detectip():
> sentence .
> You can execute the command line as long as it is a single line
> command
>
> How to Get arround this ?

if you're trying to write your own Python command-line interface,
use a real tool:

    http://www.python.org/doc/current/lib/module-code.html

if you're just trying to run code from a file, load the entire file
before you pass it to exec (or use execfile).

</F>








More information about the Python-list mailing list