Skip to content

Commit

Permalink
Make constants.py into a configuration file
Browse files Browse the repository at this point in the history
Robert904#9

So we can run multiple instances of the same code with different
configuration options.
  • Loading branch information
jmcclelland committed Jan 25, 2017
1 parent 3026f10 commit c5416a8
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion mumblerecbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,24 @@
import time
from threading import Thread

from constants import *
# Try to use the path passed in as first argument as the config
# file. If no argument is passed in, just import constants from
# the current directory.
import sys
import os

configfile = None
try:
configfile = sys.argv[1]
except IndexError:
# No config file, import the defaults
from constants import *
if configfile:
if not os.path.exists(configfile):
print "Can't find config path."
quit()
sys.path.append(os.path.dirname(os.path.expanduser(configfile)))
from config import *

import pymumble
from pymumble.constants import *
Expand Down

0 comments on commit c5416a8

Please sign in to comment.