[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #7654 [Stem]: torrc parser in stem
#7654: torrc parser in stem
-------------------------+--------------------------------------------------
Reporter: gsathya | Owner: atagar
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: Stem | Version:
Keywords: controller | Parent:
Points: | Actualpoints:
-------------------------+--------------------------------------------------
Comment(by atagar):
Hi Sathyanarayanan. That would be a fine start for a feature branch but
I'd rather not merge it until we have something a bit more complete and
with tests.
Btw, on first glance your parser will break when it encounters blank
lines...
{{{
with open(torrc_path) as torrc_fh:
for line in torrc_fh.readlines():
line = line.strip()
if line.startswith('#'):
continue
else:
key, val = line.split(' ')
torrc[key] = val
}}}
{{{
>>> line = ""
>>> if line.startswith('#'):
... pass
... else:
... key, val = line.split(' ')
...
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
ValueError: need more than 1 value to unpack
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7654#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs