python - Empty SVG file errror while it's not -


working pycairo, create "svgsurface" (which create me svg file) , write on using "context". after finish, need use svg file, seems file not closed gave me error telling document empty.

    ps = cairo.svgsurface("header.svg", width, height)     cr = cairo.context(ps)     drawrectangle (cr,         papersize.convert_length(int(lg[0]), "px","pt"),         papersize.convert_length(int(lg[2]), "px","pt"),         papersize.convert_length(int(lg[1])-int(lg[0])-1, "px","pt"),         papersize.convert_length(int(lg[3])-int(lg[2])-1, "px","pt"),         0, 0, 0.5     )     cr.show_page()     head = st.fromfile("header.svg") 

it gives me error :

 file "/usr/local/lib/python2.7/dist-packages/svgutils/transform.py", line 249, in fromfile     svg_file = etree.parse(fid)   file "src/lxml/lxml.etree.pyx", line 3427, in lxml.etree.parse (src/lxml/lxml.etree.c:81117)   file "src/lxml/parser.pxi", line 1832, in lxml.etree._parsedocument (src/lxml/lxml.etree.c:118116)   file "src/lxml/parser.pxi", line 1852, in lxml.etree._parsefilelikedocument (src/lxml/lxml.etree.c:118399)   file "src/lxml/parser.pxi", line 1747, in lxml.etree._parsedocfromfilelike (src/lxml/lxml.etree.c:117187)   file "src/lxml/parser.pxi", line 1162, in lxml.etree._baseparser._parsedocfromfilelike (src/lxml/lxml.etree.c:111914)   file "src/lxml/parser.pxi", line 595, in lxml.etree._parsercontext._handleparseresultdoc (src/lxml/lxml.etree.c:105109)   file "src/lxml/parser.pxi", line 706, in lxml.etree._handleparseresult (src/lxml/lxml.etree.c:106817)   file "src/lxml/parser.pxi", line 635, in lxml.etree._raiseparseerror (src/lxml/lxml.etree.c:105671) lxml.etree.xmlsyntaxerror: document empty, line 1, column 1 (line 1) 

i tried close file os didn't work


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -