can't initiate client on python2.7
Hey @leo-singer,
I've been using sleek-lvalert for some lvalert tool development and have encountered an issue running in a python2 vs python3 virtualenv. I can initiate a client just fine in a python3 virtualenv with:
client = sleek_lvalert.LVAlertClient(username='alexander.pace', server='lvalert-test.cgca.uwm.edu', netrc='/home/alexander.pace/.netrc')
But running the same command inside a python2.7 virtualenv fails with:
In [8]: client = sleek_lvalert.LVAlertClient(username='alexander.pace', server='lvalert-test.cgca.uwm.edu', netrc='/home/alexander.pace/.netrc')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-8-1c60797fea55> in <module>()
----> 1 client = sleek_lvalert.LVAlertClient(username='alexander.pace', server='lvalert-test.cgca.uwm.edu', netrc='/home/alexander.pace/.netrc')
/home/alexander.pace/git/sleekenv/lib/python2.7/site-packages/sleek_lvalert/__init__.pyc in __init__(self, username, password, resource, netrc, interactive, server)
121 interactive=False, server=DEFAULT_SERVER):
122 username, password = _get_login(
--> 123 username, password, netrc, interactive, server)
124 if resource is None:
125 resource = uuid.uuid4().hex
/home/alexander.pace/git/sleekenv/lib/python2.7/site-packages/sleek_lvalert/__init__.pyc in _get_login(username, password, netrc, interactive, server)
55
56 def _get_login(username, password, netrc, interactive, server):
---> 57 default_username, default_password = _get_default_login(netrc, server)
58 prompt = 'password for {}@{}: '.format(username, server)
59
/home/alexander.pace/git/sleekenv/lib/python2.7/site-packages/sleek_lvalert/__init__.pyc in _get_default_login(netrcfile, server)
40 def _get_default_login(netrcfile, server):
41 try:
---> 42 netrcfile = _Netrc(netrcfile)
43 except (OSError, netrc.NetrcParseError):
44 log.exception('Cannot load netrc file: %s', netrc)
/home/alexander.pace/git/sleekenv/lib/python2.7/site-packages/sleek_lvalert/__init__.pyc in __init__(self, file)
35 self.macros = {}
36 with open(file) as fp:
---> 37 self._parse(file, fp, True)
38
39
TypeError: _parse() takes exactly 3 arguments (4 given)
I'm going to move forward with the python3 environment right now, but we should consider adding python2.7 back-compatibility moving forward, unless you have any other suggestions.