Skip to content

Commit

Permalink
use proper location of inifile when started from another location
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoostenveld committed Jan 7, 2016
1 parent ff4b9b4 commit 193b1dc
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 6 deletions.
10 changes: 9 additions & 1 deletion module/devirtualizer/devirtualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
import ConfigParser # this is version 2.x specific, on version 3.x it is called "configparser" and has a different API
import redis
import serial
import sys
import os

if hasattr(sys, 'frozen'):
basis = sys.executable
else:
basis = sys.argv[0]
installed_folder = os.path.split(basis)[0]

config = ConfigParser.ConfigParser()
config.read('devirtualizer.ini')
config.read(os.path.join(installed_folder, 'devirtualizer.ini'))

r = redis.StrictRedis(host=config.get('redis','hostname'), port=config.getint('redis','port'), db=0)
try:
Expand Down
10 changes: 9 additions & 1 deletion module/keyboard/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
import time
import ConfigParser # this is version 2.x specific, on version 3.x it is called "configparser" and has a different API
import redis
import sys
import os

if hasattr(sys, 'frozen'):
basis = sys.executable
else:
basis = sys.argv[0]
installed_folder = os.path.split(basis)[0]

config = ConfigParser.ConfigParser()
config.read('keyboard.ini')
config.read(os.path.join(installed_folder, 'keyboard.ini'))

r = redis.StrictRedis(host=config.get('redis','hostname'), port=config.getint('redis','port'), db=0)
try:
Expand Down
10 changes: 9 additions & 1 deletion module/launchcontrol/launchcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
import time
import ConfigParser # this is version 2.x specific, on version 3.x it is called "configparser" and has a different API
import redis
import sys
import os

if hasattr(sys, 'frozen'):
basis = sys.executable
else:
basis = sys.argv[0]
installed_folder = os.path.split(basis)[0]

config = ConfigParser.ConfigParser()
config.read('launchcontrol.ini')
config.read(os.path.join(installed_folder, 'launchcontrol.ini'))

r = redis.StrictRedis(host=config.get('redis','hostname'), port=config.getint('redis','port'), db=0)
try:
Expand Down
10 changes: 9 additions & 1 deletion module/pulsegenerator/pulsegenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
import ConfigParser # this is version 2.x specific, on version 3.x it is called "configparser" and has a different API
import redis
import serial
import sys
import os

if hasattr(sys, 'frozen'):
basis = sys.executable
else:
basis = sys.argv[0]
installed_folder = os.path.split(basis)[0]

config = ConfigParser.ConfigParser()
config.read('pulsegenerator.ini')
config.read(os.path.join(installed_folder, 'pulsegenerator.ini'))

r = redis.StrictRedis(host=config.get('redis','hostname'), port=config.getint('redis','port'), db=0)
try:
Expand Down
10 changes: 9 additions & 1 deletion module/sequencer/sequencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
import ConfigParser # this is version 2.x specific,on version 3.x it is called "configparser" and has a different API
import redis
import time
import sys
import os

if hasattr(sys, 'frozen'):
basis = sys.executable
else:
basis = sys.argv[0]
installed_folder = os.path.split(basis)[0]

config = ConfigParser.ConfigParser()
config.read('sequencer.ini')
config.read(os.path.join(installed_folder, 'sequencer.ini'))

r = redis.StrictRedis(host=config.get('redis','hostname'),port=config.getint('redis','port'),db=0)
try:
Expand Down
10 changes: 9 additions & 1 deletion module/synthesizer/synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@
import multiprocessing
import threading
import time
import sys
import os

if hasattr(sys, 'frozen'):
basis = sys.executable
else:
basis = sys.argv[0]
installed_folder = os.path.split(basis)[0]

config = ConfigParser.ConfigParser()
config.read('synthesizer.ini')
config.read(os.path.join(installed_folder, 'synthesizer.ini'))

r = redis.StrictRedis(host=config.get('redis','hostname'),port=config.getint('redis','port'),db=0)
try:
Expand Down

0 comments on commit 193b1dc

Please sign in to comment.