python : cannot instantiate more than one or two variables (SyntaxError raised) -
since yesterday, i'm having unusual issue when testing new python scripts. when running script, 'syntaxerror: invalid syntax' on 1 of first variable assignment.
for exemple, simple code made loading screen options text file (that exists in same directory) :
#!/usr/bin/env python2.7 import configparser config = configparser.rawconfigparser() config.read('config.txt') fullscreen = bool(config.get('screen', 'fullscreen') width = int(config.get('screen', 'width') height = int(config.get('screen', 'height') ...
when run in terminal, returns :
file "./config.py", line 8 width = int(config.get('screen', 'width') ^ syntaxerror: invalid syntax
more strangely, when comment fullscreen line out, same error... on next line (height = ...). meaning lastly 1 indeed syntax valid? problem occurs on new files, older ones work (well, @ to the lowest degree there's no error :) ). and, lastly not least... when i'm using text editor (like kate, utilize vim), writing exact same code raises no error either
i tried reinstall vim thought problem came from, it's still same.
thanks time , sorry english, charles
you're missing trailing right bracket close bool
:
fullscreen = bool(config.get('screen', 'fullscreen')) ^
and same int
:
width = int(config.get('screen', 'width')) ^ height = int(config.get('screen', 'height')) ^
python variables vim syntax-error
No comments:
Post a Comment