Update LBRYConsole.py
Forgetting to add a new line at the end of lbrycrd.conf will no longer mess up the rpc login.
This commit is contained in:
parent
b80d45ad45
commit
31ee3fb12b
1 changed files with 15 additions and 1 deletions
|
@ -220,11 +220,25 @@ class LBRYConsole():
|
||||||
d = self.settings.save_lbryid(self.lbryid)
|
d = self.settings.save_lbryid(self.lbryid)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
def _check_config_newlines(self, config_path):
|
||||||
|
f = open(config_path, 'r')
|
||||||
|
lines = [l for l in f]
|
||||||
|
f.close()
|
||||||
|
if lines[-1][-1] != "\n":
|
||||||
|
f = open(config_path, 'w')
|
||||||
|
for l in lines:
|
||||||
|
if l[-1] == "\n":
|
||||||
|
f.write(l)
|
||||||
|
else:
|
||||||
|
f.write(l + "\n")
|
||||||
|
f.close()
|
||||||
|
|
||||||
def _get_lbrycrd_settings(self):
|
def _get_lbrycrd_settings(self):
|
||||||
settings = {"username": "rpcuser",
|
settings = {"username": "rpcuser",
|
||||||
"password": "rpcpassword",
|
"password": "rpcpassword",
|
||||||
"rpc_port": 8332}
|
"rpc_port": 8332}
|
||||||
if os.path.exists(self.lbrycrd_conf):
|
if os.path.exists(self.lbrycrd_conf):
|
||||||
|
self._check_config_newlines(self.lbrycrd_conf)
|
||||||
lbrycrd_conf = open(self.lbrycrd_conf)
|
lbrycrd_conf = open(self.lbrycrd_conf)
|
||||||
for l in lbrycrd_conf:
|
for l in lbrycrd_conf:
|
||||||
if l.startswith("rpcuser="):
|
if l.startswith("rpcuser="):
|
||||||
|
|
Loading…
Reference in a new issue