Uniconvertor formats export fails on Windows 7 (python.exe crashes)

Bug #656938 reported by M8R-98booy
76
This bug affects 12 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Abe Yo

Bug Description

Open the attached svg and try to export to WMF.
Result: Phyton.exe crashes (and Inkscape displays: UniConvertor failed: )

I use 0.48 Win7 x64.

This bug could be related to Bug #474963, but I'm not sure if they are identical. The file was created using copy and paste from another drawing program, but I deleted most of the stuff. Export to EMF works fine.

Revision history for this message
M8R-98booy (m8r-98booy) wrote :
su_v (suv-lp)
tags: added: exporting uniconvertor wmf
Revision history for this message
Alvin Penner (apenner) wrote :

- not reproduced on Windows XP (32 bit), Inkscape 0.48.0 r9654 (Aug 16 2010)
- wmf file attached
- could you attach the complete error message, or is that all there was?
- what happens when you try to Save As .PLT, which also uses uniconvertor

Revision history for this message
M8R-98booy (m8r-98booy) wrote :

I ran inkscape with gdb (within cygwin) and then I don't get the windows "Phyton.exe has crashed.."-dialog, but Inkscape tells me:
Traceback (most recent call last):

  File "wmf_output.py", line 27, in <module>

    cmd = get_command()

  File "C:\Inkscape\share\extensions\uniconv_output.py", line 99, in get_command

    p = Popen('uniconvertor', shell=True, stdout=PIPE, stderr=PIPE).wait()

  File "C:\Inkscape\python\Lib\subprocess.py", line 626, in __init__

    errread, errwrite) = self._get_handles(stdin, stdout, stderr)

  File "C:\Inkscape\python\Lib\subprocess.py", line 734, in _get_handles

    p2cread = self._make_inheritable(p2cread)

  File "C:\Inkscape\python\Lib\subprocess.py", line 773, in _make_inheritable

    DUPLICATE_SAME_ACCESS)

WindowsError: [Error 6] The handle is invalid

The JessInk zipped pdf or png output (*.zip) and The HP Graphics ... *.PLT crashes with:
Traceback (most recent call last):

  File "jessyInk_export.py", line 172, in <module>

    e = MyEffect()

  File "jessyInk_export.py", line 77, in __init__

    self.inkscapeCommand = self.findInkscapeCommand()

  File "jessyInk_export.py", line 164, in findInkscapeCommand

    proc = subprocess.Popen([command + " --without-gui --version"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

  File "C:\Inkscape\python\Lib\subprocess.py", line 626, in __init__

    errread, errwrite) = self._get_handles(stdin, stdout, stderr)

  File "C:\Inkscape\python\Lib\subprocess.py", line 734, in _get_handles

    p2cread = self._make_inheritable(p2cread)

  File "C:\Inkscape\python\Lib\subprocess.py", line 773, in _make_inheritable

    DUPLICATE_SAME_ACCESS)

WindowsError: [Error 6] The handle is invalid

su_v (suv-lp)
tags: added: extensions-plugins python win32
removed: exporting uniconvertor wmf
Revision history for this message
Alvin Penner (apenner) wrote :

- it looks like the module subprocess.py is causing a problem, perhaps this is a 64-bit issue.
- just as a double-check, could you try to Save As .DXF (Desktop Cutting Plotter (R13) .dxf)
- this will use Python, but will not use the subprocess.py module.

Revision history for this message
M8R-98booy (m8r-98booy) wrote :

export to .dxf works fine.

Revision history for this message
Alvin Penner (apenner) wrote :

good to hear. so it is probably related to subprocess.py. This module is used to start a second process running and bring the results back into Inkscape.

Revision history for this message
Catalin Patulea (cpatulea) wrote :

M8R-98booy, can you try making the following changes to uniconv_output.py:

On every line with Popen(), add the following argument before stdout=:
stdin=os.open(os.devnull)

jazzynico (jazzynico)
Changed in inkscape:
importance: Undecided → Medium
Revision history for this message
M8R-98booy (m8r-98booy) wrote :

I added the argument, but it seems the code is wrong:

Traceback (most recent call last):

  File "wmf_output.py", line 27, in <module>
    cmd = get_command()
  File "C:\Inkscape\share\extensions\uniconv_output.py", line 99, in get_command
    p = Popen('uniconvertor', shell=True, stdin=os.open(os.devnull) , stdout=PIPE, stderr=PIPE).wait()
TypeError: function takes at least 2 arguments (1 given)

Revision history for this message
M8R-98booy (m8r-98booy) wrote :

I also tried
stdin=os.open(os.devnull,os.O_RDONLY)

but then the original problem (Phyton.exe crashed) is back.

Revision history for this message
Alvin Penner (apenner) wrote :

confirmed on Windows 7 (32 bit), this appears to be the same as Bug 721352

Changed in inkscape:
status: New → Confirmed
su_v (suv-lp)
tags: added: uniconvertor
Revision history for this message
Alvin Penner (apenner) wrote :

on Windows 7 (32 bit), the conversion to wmf can be performed using the following software (outside of Inkscape):
- Python 2.6.6
- PIL 1.1.7
- reportlab 2.5
- uniconvertor 1.1.4

- run uniconvertor from a DOS prompt with the command:
  C:\Python26>scripts\uniconv test.svg test.wmf
- result is attached:

su_v (suv-lp)
tags: removed: python
Revision history for this message
su_v (suv-lp) wrote : Re: WMF Export fails on Windows 7 (python.exe crashes)

See also (from the duplicates):
<quote>
there are a number of google hits associated with this message, not Inkscape-related, but probably Vista/Windows7 specific:

http://www.google.ca/#hl=en&source=hp&biw=779&bih=399&q=python.exe+has+stopped+working&aq=f&aqi=g2&aql=&oq=&fp=51569ce59b9bf889
</quote>
<https://bugs.launchpad.net/inkscape/+bug/721352/comments/4>

summary: - WMF Export fails
+ WMF Export fails on Windows 7 (python.exe crashes)
Revision history for this message
Adrian Evaraldo (adrievar) wrote :

Following the Alvin Penner's comment, I've found that if you download and install the uniconvertor 1.1.5, and you patch the inkscape with this last uniconvertor release, you won't have to use a DOS prompt. You only need to save the file as a wmf file in inkscape

Revision history for this message
M8R-98booy (m8r-98booy) wrote :

The problem still exists in Inkscape 0.48.3.1 r9886. Can you just include the updated uniconvertor 1.1.5 in the next release?

Revision history for this message
André Bachmann (andrebachmann-dd) wrote :

I just encountered the crash as I was trying to export a SVG file into WMF format. The crash happens with Inkscape 0.48.2 r9819 (running under Win7 x64) with the message "UniConvertor failed:" followed by some empty lines.
A maybe related crash happens with Inkscape 0.47 r22583, built Mar 12 2010 (running under Debian Squeeze x64). However, here it is another error, Inkscape shows this:

Traceback (most recent call last):
  File "/usr/share/inkscape/extensions/wmf_output.py", line 27, in <module>
    cmd = get_command()
  File "/usr/share/inkscape/extensions/uniconv_output.py", line 118, in get_command
    sys.stderr.write(_('You need to install the UniConvertor software.\n'+\
NameError: global name '_' is not defined

Please let me know if you need further information.

Revision history for this message
André Bachmann (andrebachmann-dd) wrote :

Please forget the last part about Inkscape in Squeeze, python-uniconvertor wasn't installed - my fault.

Revision history for this message
Graham Wall (g-hamwall) wrote :

Also seeing this in Windows 8, Inkscape version 0.48.4 r9939.

Steps to reproduce:
1. Open Inkscape
2. Draw a circle with default settings
3. Save As... -> *.wmf type

Dialog "python.exe has stopped working"
Select "close program"
Dialog "Inkscape has received additional data from the script executed. The script did not return an error, but this may indicate the results will not be as expected." "UniConvertor failed:"

Revision history for this message
Abe Yo (abe-geel) wrote :

UniConverter 1.1.5 comes with a patch to update inkscape's plugin.
It's a vbs script located in "C:\Program Files (x86)\sK1 Project\UniConvertor-1.1.5\inkscape-patches"

However, the script needs administrator privileges which it doesn't request per se. (and you can't run vbs scripts as administrator by right clicking etc.) So it doesn't work correctly in newer windows versions.

Add the following lines to the beginning of the script to make it request the necessary permissions:

-- code start --
If Not WScript.Arguments.Named.Exists("elevate") Then
  CreateObject("Shell.Application").ShellExecute WScript.FullName _
    , """" & WScript.ScriptFullName & """ /elevate", "", "runas", 1
  WScript.Quit
End If
-- code end--

The script also may lose focus, so switch to it using the taskbar.

Revision history for this message
Abe Yo (abe-geel) wrote :

Or, if you want to patch the source, I made a patchfile. Interestingly the file dates are older in the update and contain less code.

Revision history for this message
Abe Yo (abe-geel) wrote :

That patch was not very clean, since it removes all checks on whether uniconverter is installed...

Here is a better patch and the relevant py files which can be replaced directly in [inkscape folder]share\extensions\

Revision history for this message
Abe Yo (abe-geel) wrote :

Export extension
To be placed in [inkscape folder]share\extensions\

Let me know, if it works correctly

Revision history for this message
Abe Yo (abe-geel) wrote :

Import Extension (second wmf import filter)
To be placed in [inkscape folder]share\extensions\

Let me know, if it works correctly

Revision history for this message
su_v (suv-lp) wrote :

> Let me know, if it works correctly

Quick test with patched Inkscape 0.48.4 and UniConvertor 1.1.5 on OS X 10.7.5: the changes appear to completely break UniConvertor support on this platform (opening a simple CDR file fails [1], and prompts to install UniConvertor). Works as expected without the patch (UniConvertor 1.1.5 is installed and gets used for import e.g. of CDR files).

Not tested on any Linux distro.

[1] <https://bugs.launchpad.net/inkscape/+bug/442010/+attachment/771958/+files/Frenchcurve.cdr>

Revision history for this message
su_v (suv-lp) wrote :

On 2014-05-15 13:47 +0100, ~suv wrote:
> Quick test with patched Inkscape 0.48.4 and UniConvertor 1.1.5 on OS
> X 10.7.5: the changes appear to completely break UniConvertor support
> on this platform (…)

AFAICT it is the import of UniConvertor as python module that fails with the patched version: if the command line app 'uniconvertor' is found in $PATH, the patched version works ok (for the same test case). My local install of UniConvertor 1.1.5 however uses a python version suffix for the installed script (uniconvertor-2.7), and thus is not detected by the script. Falling back to importing as python module works with the unpatched extension scripts as expected.

It would be great if a fix for the Windows platform doesn't remove features for other platforms.

Revision history for this message
Abe Yo (abe-geel) wrote :

Sorry... This patch should now also work on unix platforms.

Revision history for this message
Abe Yo (abe-geel) wrote :

Here the repaired export extension ...

Revision history for this message
Abe Yo (abe-geel) wrote :

... and the import extension.

Only checked on Windows 7 and Ubuntu, though. Hope it works on other platforms, too now.

jazzynico (jazzynico)
Changed in inkscape:
status: Confirmed → In Progress
assignee: nobody → Abe Yo (abe-geel)
milestone: none → 0.91
tags: added: backport-proposed
Revision history for this message
su_v (suv-lp) wrote :

Latest version of patch doesn't really apply … could you recreate one with 'diff -u' (or with 'bzr diff share/extensions/' if you have a checkout of stable or trunk branch)?

$ patch -p1 --dry-run < 656938-uniconvertor_patch_better-v2.patch
patching file share/extensions/uniconv-ext.py
patch: **** replacement text or line numbers mangled in hunk at line 30

Revision history for this message
su_v (suv-lp) wrote :

Diff based on stable branch (lp:inkscape/0.48.x) after replacing the two extensions scripts (please verify).

Revision history for this message
su_v (suv-lp) wrote :

Diff '656938-uniconvertor_patch_better-v2-048x.diff ' tested successfully on OS X 10.7.5 (no 'uniconvertor' script in $PATH, but available as python module for import, see comments 23-24) with Inkscape 0.48.4 r10031. Not tested with trunk.

Revision history for this message
Abe Yo (abe-geel) wrote :

The trunk has changed slightly since 0.48... (inkex.localize and encoding statements)

Here the patch for trunk. (new line numbers and a slight change in line order, this time made with bzr)

Unfortunately I didn't manage to compile inkscape on my windows machine. It works on Windows 7 with the 0.91 build found on graphicall.org though.

jazzynico (jazzynico)
summary: - WMF Export fails on Windows 7 (python.exe crashes)
+ Uniconvertor formats export fails on Windows 7 (python.exe crashes)
Revision history for this message
jazzynico (jazzynico) wrote :

Note that 0.91 now uses a different internal extension to export to WMF, thus WMF format can't be used to test the patch from comment #31. SK1 and PLT are the only formats that need uniconvertor to export.

Revision history for this message
jazzynico (jazzynico) wrote :

Also note that uniconvertor fails on Crunchbang Waldorf (not related to the patch) due to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705750

Revision history for this message
jazzynico (jazzynico) wrote :

Tested for regressions on Windows XP, Inkscape 0.48.4 and trunk revision 13397.

Unfortunately, the patched versions return the following message:
---
You need to install the UniConvertor software.
For GNU/Linux: install the package python-uniconvertor.
For Windows: download it from
http://sk1project.org/modules.php?name=Products&product=uniconvertor
and install into your Inkscape's Python location
---

Such an install shouldn't be needed since Uniconvertor is already available (python\Lib\site-packages\uniconvertor) in the Inkscape installation folder.

Revision history for this message
Abe Yo (abe-geel) wrote :

Now I'm getting confused... I cannot reproduce the python.exe crash anymore on my windows 7. The original files simply do work now. (and the said plugin included in inkscape just works out of the box without the separate uniconvertor installation on inkscape 0.48.4). So probably I was wandering in the totally wrong direction ...
(on another windows 8 machine, however python.exe does crash) So is there is still something going wrong?

Ah, and in inkscape 0.91 I saw two wmf import/export choices in the drop down list. The latter points to uniconvertor... (if not removed in the latest version)

Revision history for this message
Abe Yo (abe-geel) wrote :

Found the problem: the uniconvertor libraries have not been updated with the current uniconvertor release.
Only need to update uniconvertor and sk1libs in python/site-packages
The original extensions' scripts work fine, although they contain a now redundant check for a uniconvertor installation.

Here the files that have changed.

Changed in inkscape:
status: In Progress → Fix Released
su_v (suv-lp)
Changed in inkscape:
milestone: 0.91 → 0.48.5
su_v (suv-lp)
tags: removed: backport-proposed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.