pytsp
pytsp copied to clipboard
TypeError: a bytes-like object is required, not 'str'
>>> matrix = [
... [ 0, 2910, 4693 ],
... [ 2903, 0, 5839 ],
... [ 4695, 5745, 0 ]]
>>> from pytsp import atsp_tsp, run, dumps_matrix
>>> matrix_sym = atsp_tsp(matrix, strategy="avg")
>>> outf = "/tmp/myroute.tsp"
>>> with open(outf, 'w') as dest:
... dest.write(dumps_matrix(matrix_sym, name="My Route"))
...
177
>>> tour = run(outf, start=10, solver="concorde")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ajay/miniconda3/lib/python3.6/site-packages/pytsp/__init__.py", line 106, in run
metadata = output.strip().split("\n")
TypeError: a bytes-like object is required, not 'str'
>>>
I was able to temporarily get around this by commenting out the metadata and solution lines since I'm only interested in the raw.