fsmMLK / inkscapeMadeEasy

Set of python modules that extends Aaron Spike's inkex.py module, adding methods and classes to help the development of new extensions for inkscape.
GNU General Public License v3.0
210 stars 29 forks source link

Can't open object member file #8

Closed Bigstrong-hust closed 4 years ago

Bigstrong-hust commented 4 years ago

Hi, fsmMLK, thank you for your contribution firstly. There is something wrong when I try to use the extension inkscapeMadeEasy and the errors reading " can't open object member file: c:\users\mycomputername\appdata\local\temp/temp_svg_inkscapeMadeEasy_Draw.txt". I also have checked the system temporary folder and found no such temporay file named "temp_svg_inkscapeMadeEasy_Draw.txt".

So I tried to create a temporary file named "temp_svg_inkscapeMadeEasy_Draw.txt", then I got these.

Traceback (most recent call last): File "cartesianAxes2D.py", line 90, in axis.affect() File "inkex.py", line 283, in affect self.effect() File "cartesianAxes2D.py", line 85, in effect xGrid=so.xGrid, yGrid=so.yGrid, forceTextSize=textSize, forceLineWidth=lineWidthAxis) File "inkscapeMadeEasy_Plot.py", line 461, in cartesian inkDraw.text.latex(ExtensionBaseObj, groupTicks, xText, [posX + offsetX, axisOrigin[1] + offsetY], textSizeSmall, refPoint=justif) File "inkscapeMadeEasy_Draw.py", line 1227, in latex tex.affect([r'--text=' + LatexCommands + LaTeXtext, '--scale-factor=1', '--preamble-file=' + ExtensionBaseObj.getBasicLatexPackagesFile(), tempFilePath], output=False) File "inkex.py", line 279, in affect self.parse() File "inkex.py", line 202, in parse self.document = etree.parse(stream, parser=p) File "src/lxml/etree.pyx", line 3424, in lxml.etree.parse File "src/lxml/parser.pxi", line 1861, in lxml.etree._parseDocument File "src/lxml/parser.pxi", line 1881, in lxml.etree._parseFilelikeDocument File "src/lxml/parser.pxi", line 1776, in lxml.etree._parseDocFromFilelike File "src/lxml/parser.pxi", line 1187, in lxml.etree._BaseParser._parseDocFromFilelike File "src/lxml/parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult File "src/lxml/parser.pxi", line 640, in lxml.etree._raiseParseError File "c:\users\mycomputername\temp\temp_svg_inkscapeMadeEasy_Draw.txt", line 1 lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1

walgren commented 4 years ago

Hi, I actually am having the same error right now as well. Have you tried to run cartesianAxes2D without LaTeX support? That worked for me, but I haven't been able to get LaTeX within any fsmMLK extensions (I've tried dimensions as well, same error) to work. inkscapeMadeEasy_Draw.py doesn't create the text file when LaTeX is called.

I have Inkscape 0.92.4, pstoedit 3.71, ghostscript gs9.50 (both pstoedit and gs on PATH), PyGTK2, and pdf2svg. I also deleted pdf2svg, as another user reported that worked for him on Windows 7. However, once I deleted pdf2svg, Tex Text stopped working for me.

It must be some dependency not installed, or something installed in an incorrect order.

fsmMLK commented 4 years ago

thanks for the feedback. It was a small bug introduced on my last commit. I just commited a newer version and the problem should be fixed now.

walgren commented 4 years ago

Thanks for the quick response. I pulled the latest commit, and now Tex text starts and calls pdflatex, but then errs out a few lines down (1227). It seems that inkscapeMadeEasy_Draw.py can't find the temporary svg file that Tex text creates. Even though it says that the document is empty, that's because it doesn't exist.

Most recent traceback below: File "file:/c:/users/pwal5/appdata/local/temp/tmpemdkg6/tmp.svg", line 1 lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1

Bigstrong-hust commented 4 years ago

Thank you for your response! I replace the inkscapeMadeEasy-related files with the latest commits, but there seems still some bugs.

I have Inkscape-0.92.4, textext 0.11.0, PyGTK2 and pdf2svg on Windows 10 system.

Traceback (most recent call last): File "cartesianPlotData2D.py", line 156, in plot.affect() File "inkex.py", line 283, in affect self.effect() File "cartesianPlotData2D.py", line 152, in effect forceYlim=ylim,drawAxis=flagDrawAxis) File "inkscapeMadeEasy_Plot.py", line 1121, in cartesian ExtraLenghtAxisX=ExtraLenghtAxisX, ExtraLenghtAxisY=ExtraLenghtAxisY) File "inkscapeMadeEasy_Plot.py", line 461, in cartesian inkDraw.text.latex(ExtensionBaseObj, groupTicks, xText, [posX + offsetX, axisOrigin[1] + offsetY], textSizeSmall, refPoint=justif) File "inkscapeMadeEasy_Draw.py", line 1254, in latex BboxMin, BboxMax = ExtensionBaseObj.getBoundingBox(groupLatex) File "inkscapeMadeEasy_Base.py", line 920, in getBoundingBox coords = self.getPoints(element) File "inkscapeMadeEasy_Base.py", line 885, in getPoints listPoints = self.getPoints(obj) File "inkscapeMadeEasy_Base.py", line 885, in getPoints listPoints = self.getPoints(obj) File "inkscapeMadeEasy_Base.py", line 892, in getPoints coordsNP = np.hstack((np.array(listCoords), np.ones([len(listCoords), 1]))).transpose() File "C:\Program Files\Inkscape\lib\python2.7\site-packages/numpy/core/shape_base.py", line 286, in hstack return _nx.concatenate(arrs, 0) ValueError: all the input arrays must have same number of dimensions

fsmMLK commented 4 years ago

I think this might be a write permission issue in windows. check whether the tmp folder is somehow protected.

fsmMLK commented 4 years ago

I wonder if your issue is related to this: https://inneka.com/programming/python/permission-denied-to-write-to-my-temporary-file/

I am implementing a modification, following the solution presentend in this link and I hope it will solve your problems. I will upload probably in the next week.