Code Monkey home page Code Monkey logo

Comments (8)

claudep avatar claudep commented on July 18, 2024 1

I'm sorry, I don't see any obvious error on svglib side which would explain this error. I'm afraid you'll have to debug a bit more on your side.

from svglib.

claudep avatar claudep commented on July 18, 2024

I cannot reproduce. Are you sure file_path is a real file path, or is it another file-like Python object?
Do you get a "Failed to load input file!" error log line the second time?

from svglib.

hovodab avatar hovodab commented on July 18, 2024

@claudep It is a real file path(str). What is your version of svglib? I use 0.8.1.
Yes. In the body of the function svg2rlg an exception is risen

  File "src/lxml/lxml.etree.pyx", line 3442, in lxml.etree.parse (src/lxml/lxml.etree.c:81716)
  File "src/lxml/parser.pxi", line 1832, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:118903)
  File "src/lxml/parser.pxi", line 1852, in lxml.etree._parseFilelikeDocument (src/lxml/lxml.etree.c:119186)
  File "src/lxml/parser.pxi", line 1747, in lxml.etree._parseDocFromFilelike (src/lxml/lxml.etree.c:117974)
  File "src/lxml/parser.pxi", line 1162, in lxml.etree._BaseParser._parseDocFromFilelike (src/lxml/lxml.etree.c:112701)
  File "src/lxml/parser.pxi", line 595, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:105896)
  File "src/lxml/parser.pxi", line 706, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:107604)
  File "src/lxml/parser.pxi", line 635, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:106458)
  File "/var/www/control/media/logos/logo.svg", line 1
lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1

from svglib.

claudep avatar claudep commented on July 18, 2024

Changes on master from the 0.8.1 release are minor, I don't think that makes a difference.
Are you able to place a breakpoint inside the svg2rlg function to see what's happening?
Is your file a .svg or .svgz file? Which Python? On Linux, Mac, Windows?

from svglib.

hovodab avatar hovodab commented on July 18, 2024

File is .svg
Ubuntu==16.04, python==3.5.2
Exception is risen on the line doc = etree.parse(path, parser=parser)

from svglib.

claudep avatar claudep commented on July 18, 2024

I have quite a similar configuration (Debian instead of Ubuntu). That's a weird behavior.
Is the following Python code running fine for you?:

from lxml import etree
etree.parse("/var/www/control/media/logos/logo.svg")
etree.parse("/var/www/control/media/logos/logo.svg")

I don't see how the document would be empty the second time.

from svglib.

hovodab avatar hovodab commented on July 18, 2024

Yes, this runs without errors.

from svglib.

hovodab avatar hovodab commented on July 18, 2024

@claudep Yes, I think I should. Thank you for your help. I will try to dig deeper.

from svglib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.