Comments (8)
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.
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.
@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.
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.
File is .svg
Ubuntu==16.04, python==3.5.2
Exception is risen on the line doc = etree.parse(path, parser=parser)
from svglib.
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.
Yes, this runs without errors.
from svglib.
@claudep Yes, I think I should. Thank you for your help. I will try to dig deeper.
from svglib.
Related Issues (20)
- convert to pdf and png files is incorrect HOT 5
- wrong width and height attributes of drawing obj HOT 1
- Implementation error in rendering of paths with shorthand command for quadratic Bézier curves HOT 5
- Transform on clipPath does not work HOT 2
- Error when svg file contains references to font with space in its name HOT 1
- Error on install svglib HOT 2
- Reportlab 4.0.0 added dependency to pycairo HOT 3
- Error ByteIO HOT 3
- svglib fails to render properly HOT 12
- CI failure because of missing cairo HOT 9
- Using root log instead of logger HOT 3
- Units px and pt are wrong HOT 5
- Embedding SVG fonts in PDF/rlg HOT 5
- Add font size test case to test suite
- Rename default branch to main HOT 2
- Add more example and pip install commands to README.md HOT 4
- svglib doesn't remove temporary files properly? HOT 5
- Problems with embedded image sizes HOT 4
- svglib ignores <switch> nodes HOT 4
- Please share wheel file on pypi HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svglib.