Code: Select all
linux_hunt_process.pyCode: Select all
import process_properties as properties
...
if __name__ == "__main__":
properties.init()
if os.path.exists(properties.CONFIG_PATH):
print("Config file found, loading config...")
properties.load_config()
else:
print("Config file not found, creating new config...")
properties.reset_config()
print(properties.CONFIG['target_img'])
Code: Select all
process_properties.pyCode: Select all
import json
import os
import sys
def init():
global DEFAULT_CONFIG
DEFAULT_CONFIG = {...}
global CONFIG
CONFIG = DEFAULT_CONFIG.copy()
...
... # setting up global variables
...
global VIDEO_DEVICE_LIST
VIDEO_DEVICE_LIST = list()
global BLUETOOTH_LIST
BLUETOOTH_LIST = [{}]
def load_config():
global CONFIG
with open(CONFIG_PATH, "r") as configFile:
configData = json.loads(configFile.read())
...
... # copying configData into CONFIG
...
def reset_config():
global CONFIG
CONFIG = DEFAULT_CONFIG.copy()
if sys.platform != "linux":
CONFIG['bluetooth'] = f'{BLUETOOTH_LIST[0]['product']} ({BLUETOOTH_LIST[0]['manufacturer']})' # this is the line 46 mentioned in the error traceback
CONFIG['bluetooth_device'] = BLUETOOTH_LIST[0]
CONFIG['video'] = VIDEO_DEVICE_LIST[0].name
with open(CONFIG_PATH, "x") as configFile:
configFile.write(json.dumps(CONFIG, indent=4))
Code: Select all
Traceback (most recent call last):
File "linux_hunt_process.py", line 1, in
import process_properties as properties
File "/vagrant/process_properties.py", line 46
CONFIG['bluetooth'] = f'{BLUETOOTH_LIST[0]['product']} ({BLUETOOTH_LIST[0]['manufacturer']})'
^
SyntaxError: invalid syntax
Mobile version