Python extension behaviour
Dear all,
Here's a call for help, as i'm totally stuck in this. I've been getting familiar with Python extensions and managed to whip up a couple. I ran into an issue, though: if i call an external command (using os.system('pwd'), for the simplest example), it executes it but doesn't go through the rest of the extension script, closing the window and returning to Inkscape. (i believe the same happens with exec statements) I thought it could be that the extension architecture doesn't allow for running external commands, but fact is that the extension actually executes it before borking. Am i missing something obvious?
Thank you ricardo
Sorry for missing this: I'm running the 0.46 Inkscape version from the Ubuntu repos (on Ubuntu Hardy). ricardo
ricardo lafuente wrote:
Dear all,
Here's a call for help, as i'm totally stuck in this. I've been getting familiar with Python extensions and managed to whip up a couple. I ran into an issue, though: if i call an external command (using os.system('pwd'), for the simplest example), it executes it but doesn't go through the rest of the extension script, closing the window and returning to Inkscape. (i believe the same happens with exec statements) I thought it could be that the extension architecture doesn't allow for running external commands, but fact is that the extension actually executes it before borking. Am i missing something obvious?
Thank you ricardo
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
ricardo lafuente wrote:
Here's a call for help, as i'm totally stuck in this. I've been getting familiar with Python extensions and managed to whip up a couple. I ran into an issue, though: if i call an external command (using os.system('pwd'), for the simplest example), it executes it but doesn't go through the rest of the extension script, closing the window and returning to Inkscape. (i believe the same happens with exec statements) I thought it could be that the extension architecture doesn't allow for running external commands, but fact is that the extension actually executes it before borking. Am i missing something obvious?
I don't know of any such limitation. There are even a few scripts included with Inkscape that execute external processes. Check out gimp_xcf.py. It executes a number of external processes of both Inkscape and GIMP.
http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/ext...
Perhaps if you include a complete example of the scripts that are causing you problems, we can better help.
Aaron Spike
Aaron Spike wrote:
ricardo lafuente wrote:
Here's a call for help, as i'm totally stuck in this. I've been getting familiar with Python extensions and managed to whip up a couple. I ran into an issue, though: if i call an external command (using os.system('pwd'), for the simplest example), it executes it but doesn't go through the rest of the extension script, closing the window and returning to Inkscape. (i believe the same happens with exec statements) I thought it could be that the extension architecture doesn't allow for running external commands, but fact is that the extension actually executes it before borking. Am i missing something obvious?
I don't know of any such limitation. There are even a few scripts included with Inkscape that execute external processes. Check out gimp_xcf.py. It executes a number of external processes of both Inkscape and GIMP.
http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/ext...
thanks for this -- i looked for plugins that executed external processes but didn't find anything. now my script is working properly; apparently, executing a command with os.popen3 will work, but os.system just left me hanging (on 0.45). i did try with the example hello_world.py script, and introducing a line like 'os.system("pwd")' will make it stop and close without warning. os.popen3 works perfectly though... so no biggie here.
thank you :o) ricardo
On Sat, 13 Sep 2008 12:33:53 +0100 ricardo lafuente <bollecs@...1994...> wrote:
apparently, executing a command with os.popen3 will work, but os.system just left me hanging (on 0.45).
Minor comment - I think both os.popen3 and os.system are deprecated in favor of subprocess.Popen - I've used that without problems in inkscape extensions. I would have expected os.system to work... maybe they'll all be changed / gone in Python 3.0?
Cheers -Terry
Does it run ok if you call it from a command line with the options as it will be getting from inkscape?
2008/9/11 ricardo lafuente <bollecs@...1994...>
Dear all,
Here's a call for help, as i'm totally stuck in this. I've been getting familiar with Python extensions and managed to whip up a couple. I ran into an issue, though: if i call an external command (using os.system('pwd'), for the simplest example), it executes it but doesn't go through the rest of the extension script, closing the window and returning to Inkscape. (i believe the same happens with exec statements) I thought it could be that the extension architecture doesn't allow for running external commands, but fact is that the extension actually executes it before borking. Am i missing something obvious?
Thank you ricardo
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
participants (4)
-
Aaron Spike
-
john cliff
-
ricardo lafuente
-
Terry Brown