diff options
author | rsiddharth <rsiddharth@ninthfloor.org> | 2014-01-02 16:18:15 +0530 |
---|---|---|
committer | rsiddharth <rsiddharth@ninthfloor.org> | 2014-01-02 16:18:15 +0530 |
commit | 5e44da9ab175ba17079c6703f2034ea51e791489 (patch) | |
tree | adaa20c84f239b713cc150abada80c563faa9f47 | |
parent | 8ee23fa7d907554d70c02778a1ff5877bffe2a04 (diff) |
IOError caused when opening non-existent topsecret.txt file is handled now.
-rw-r--r-- | src/gns_wiki.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/gns_wiki.py b/src/gns_wiki.py index dba0102..6b40936 100644 --- a/src/gns_wiki.py +++ b/src/gns_wiki.py @@ -18,13 +18,18 @@ def get_topsecret(src_dir): file. """ - secrets = open(path.join(src_dir, - "config", - "topsecret.txt"), "r").readlines() - - username = secrets[0].strip() - password = secrets[1].strip() - wikiurl = secrets[2].strip() + try: + secrets = open(path.join(src_dir, + "config", + "topsecret.txt"), "r").readlines() + + username = secrets[0].strip() + password = secrets[1].strip() + wikiurl = secrets[2].strip() + except IOError: + print "ERROR: Specify your wikiusername, password & wikiurl at \ +`src/config/topsecret.txt`. Look at the README for the proper format." + exit(1) return username, password, wikiurl |