Red 'Skull'
Red 'Skull'

Reputation: 3

there's an error in your program: invalid syntax

I'm using this version Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32

so, i have a problem here

with open(ntpserverfile) as f:
     ntplist = f.readlines()

'open' and 'as' have a redlight if i press F5 for run, im searching how fix that but im a newbie at python, someone can help me ?

Upvotes: 0

Views: 1713

Answers (1)

user2357112
user2357112

Reputation: 281262

with statements must be enabled manually in Python 2.5, and they don't exist at all in lower versions. To enable them, put the following future statement at the top of any file you want to use with statements in, after the #! line:

from __future__ import with_statement

(Specifically, the only things that can come above it are comments, the module docstring, blank lines, and other future statements.)

Upvotes: 2

Related Questions