Reputation: 21
I'm making a Windows service, one of it's functions is to retrieve the stored values from the registry.
The standalone python script works as intended, but when I try running it as a Windows service, it doesn't retrieve the stored values from the registry
# Default control targets
self.control_list = ["none", "none", "none", "none"]
# Stored control targets
self.settings = QSettings("CompanyName", "ProductName")
self.load_volume_targets()
logging.info(self.settings.fileName())
def load_volume_targets(self):
saved_targets = self.settings.value("currentlySavedVolumeTargets", [])
if isinstance(saved_targets, list) and len(saved_targets) == 1:
targets = saved_targets[0].split(", ")
self.control_list = targets
logging.info("Saved control targets loaded:", self.control_list)
The service correctly logs the correct path with logging.info(self.settings.fileName())
\HKEY_CURRENT_USER\Software\CompanyName\ProductName
The standalone script finds and prints out the saved values correctly:
Saved control targets loaded: ['Master', 'None', 'None', 'None']
\HKEY_CURRENT_USER\Software\CompanyName\ProductName
The code is the same for the standalone script and the service, both of them are in a class.
How can I debug why can't the service retrieve the values from the regstry?
Upvotes: 0
Views: 15