dot2tex icon indicating copy to clipboard operation
dot2tex copied to clipboard

Newlines from the dot output are not handled correctly

Open KCaglarCoskun opened this issue 4 years ago • 0 comments

I cannot provide a MWE, but I think I should be able to explain the issue thoroughly.

I tried to print a graph and in dot2tex.py, at line 210 (p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE, close_fds=(sys.platform != 'win32'))) the program dot is called as: "C:\\Program Files\\Graphviz\\bin\\dot.exe" -Txdot [C:\\Users\\kcagl\\AppData\\Local\\Temp\\tmpbbkxuhzw

I ran the same command myself in PowerShell and noticed the new lines that are created: 1

The reason I was investigating this was the following error: File "C:\Users\kcagl\AppData\Local\Programs\Python\Python310\lib\site-packages\dot2tex\dot2tex.py", line 169, in smart_float number_as_string = "%s" % float(number) ValueError: could not convert string to float: '\\\r\n881.34'

If I am correct, dot2tex should probably strip away any occurrences of \\\r\n from the output of dot.

I am in Windows 10, use dot2tex from python, and pip reports its version as 2.11.3

KCaglarCoskun avatar Feb 09 '22 20:02 KCaglarCoskun