On Wed, Apr 18, 2012 at 12:31 AM, Nibin V M <nibi...@gmail.com> wrote: > # python test.py > File "test.py", line 1 > with open('/etc/trueuserowners') as res_own_file: > ^ > IndentationError: unexpected indent
Make sure your first code line is flush left. Since indentation indicates block structure (and not scoping, as it does in C-like languages), Python refuses to allow it anywhere other than inside something that can make use of it. If you're copying and pasting a huge lot of code from somewhere and it's all indented a minimum of a couple of spaces, the simplest solution may be to add a line at the top saying "if True:", thus making your whole program into a massive block if, which Python will happily accept. ChrisA -- http://mail.python.org/mailman/listinfo/python-list