forked from bartvdbraak/blender
attempt to make executing an external command work with python 2.4 & 2.5, it seems that only py 2.6 wanted list args for subprocess.Popen
This commit is contained in:
parent
db67426dbf
commit
5161c2ee3a
@ -60,6 +60,26 @@ except:
|
|||||||
Draw.PupMenu('Error: Recent version of Python not installed.')
|
Draw.PupMenu('Error: Recent version of Python not installed.')
|
||||||
subprocess=None
|
subprocess=None
|
||||||
|
|
||||||
|
def os_run(appstring, filename):
|
||||||
|
'''
|
||||||
|
Run the app, take into account different python versions etc
|
||||||
|
looks like python 2.6 wants a list for
|
||||||
|
'''
|
||||||
|
|
||||||
|
# evil trick, temp replace spaces so we can allow spaces in filenames
|
||||||
|
# also allows multiple instances of %f
|
||||||
|
appstring = appstring.replace(' ', '\t')
|
||||||
|
appstring = appstring.replace('%f', filename)
|
||||||
|
appstring = appstring.split('\t')
|
||||||
|
|
||||||
|
print ' '.join(appstring)
|
||||||
|
|
||||||
|
try: # only python 2.6 wants a list?
|
||||||
|
p = subprocess.Popen(appstring)
|
||||||
|
except:
|
||||||
|
p = subprocess.Popen(' '.join(appstring))
|
||||||
|
|
||||||
|
|
||||||
def edit_extern(image=None):
|
def edit_extern(image=None):
|
||||||
|
|
||||||
if not image:
|
if not image:
|
||||||
@ -101,7 +121,7 @@ def edit_extern(image=None):
|
|||||||
elif platform == 'darwin':
|
elif platform == 'darwin':
|
||||||
appstring = 'open "%f"'
|
appstring = 'open "%f"'
|
||||||
else:
|
else:
|
||||||
appstring = 'gimp-remote "%f"'
|
appstring = 'gimp %f'
|
||||||
|
|
||||||
appstring_but = Draw.Create(appstring)
|
appstring_but = Draw.Create(appstring)
|
||||||
save_default_but = Draw.Create(0)
|
save_default_but = Draw.Create(0)
|
||||||
@ -126,13 +146,8 @@ def edit_extern(image=None):
|
|||||||
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
# evil trick, temp replace spaces so we can allow spaces in filenames
|
os_run(appstring, imageFileName)
|
||||||
appstring = appstring.replace(' ', '\t')
|
|
||||||
|
|
||||||
appstring = appstring.replace('%f', imageFileName)
|
|
||||||
appstring = appstring.split('\t')
|
|
||||||
print 'Editing image with command "%s"' % appstring
|
|
||||||
p = subprocess.Popen(appstring)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Loading…
Reference in New Issue
Block a user