Phyton Export Skritp, wrong paths... (WINDOWS)

Bug #1013140 reported by Gabriel on 2012-06-14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Hannes Hochreiner

Bug Description

The script has funny absolute paths!

sys.path.append('C:\Program Files (x86)\Inkscape\share\extensions')

and the function for finding the command is crucial otherwise the script does not work:

with the new python2.7(folder ) (renamed to python) inside the inkscape folder

# Function to try and find the correct command to invoke Inkscape.
 def findInkscapeCommand(self):
  commands = []
  # commands.append("\"C:\Program Files (x86)\Inkscape\inkscape.exe\"")

  for command in commands:
   proc = subprocess.Popen(command + " --without-gui --version", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
   stdout_value, stderr_value = proc.communicate()

   if proc.returncode == 0:
    return command

  return None

Gabriel (gnuetzi) wrote :

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

I REMOVED THE brackets [] in this command

and in another one above in the code, where the layer gets exportet :-)

Hi Gabriel:

Thanks for the hint. Just out of interest: where did you get the export script with this path from. Since the path is not in repository like this I would suspect that it was a packaging modification.

Changed in jessyink:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Hannes Hochreiner (hannes-hochreiner)

Hello :-). ehm - i got the script.with the inkscape installation. There are
funny absolute paths and take.a.closet look at the subprocess command : ( i
am no phyton expert :-), but this command :

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

works only in this.form without the brackets [...] !!!
there are two such lines in tje export script....

br gabriel
Am 16.06.2012 10:30 schrieb "Hannes Hochreiner" <email address hidden>:

Going by my experience and the python documentation, I think that the brackets don't matter in this case. True, they are not necessary, but as I understand it they don't do any harm. I would guess they are left over from test with separating the arguments. For documentation on the subprocess.Popen command please refer to:

As for the path, if relative paths work they are definitely preferable. I don't have a Windows box to test that out. I would guess the Inkscape package you have was prepared for 64 bit Windows with Inkscape installed as a 32 bit application. In this case the path would look reasonable (although I can't say whether it is correct or not).

My suggestion would be to use the relative path you posted in addition to the absolute paths already in the script. Do you think that's a reasonable solution?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers