alexforencich / python-hpgl

Python HPGL parsing library
MIT License
18 stars 3 forks source link

issue with parse_hpgl1 #1

Closed emcware closed 6 years ago

emcware commented 6 years ago

hello, I tried your python-hpgl tool to convert a .plt file obtained using KE5FX toolkit from my hp8595E. That tool captures and renders the image but when I try to parse the file with parse_hpgl1 I get this error:

File "C:\Users\45207\PycharmProjects\python-hpgl\hpgl\hpgl.py", line 238, in parse_hpgl raise Exception("Unknown HPGL command (%s)" % cmd) Exception: Unknown HPGL command (b'PU')

I have attached the .plt file but renamed as a .txt file from_KE5FX_no_trace.txt . I did not include the trace to keep the file as short as possible.

emcware commented 6 years ago

I figure out what the problem was. The file was being opening in binary but the parser is expecting text. I changed line 62 as shown below:

glf = open(gl_file, 'rb') This was opening the file in binary.

    glf = open(gl_file, 'r')
alexforencich commented 6 years ago

Fixed, along with a few other changes that had not been committed. Looks like the cli wrapper was right, but not the main parse method.