From 4d429531356fc810e307df6a2bfbdb5172908f53 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 20 Jun 2010 13:52:44 +0200 Subject: [PATCH] make rename and executes work in linux --- pyfpdb/fpdb.py | 5 ++++- pyfpdb/fpdb.pyw | 6 +++++- run_fpdb.py | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 191f1d15..7ac8dfec 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -25,5 +25,8 @@ import sys sys.stdout.write('fpdb.py has been renamed to fpdb.pyw - now calling fpdb.pyw ...\n\n') sys.stdout.flush() -os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) +if os.name=='nt': + os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) +else: + os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run) diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 58a1b230..7b1d6cd0 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- #Copyright 2008 Steffen Jobbagy-Felso #This program is free software: you can redistribute it and/or modify @@ -35,7 +36,10 @@ if os.name == 'nt' and sys.version[0:3] not in ('2.5', '2.6') and '-r' not in sy os.environ['PATH'] = tmppath print "Python " + sys.version[0:3] + ' - press return to continue\n' sys.stdin.readline() - os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run) + if os.name=='nt': + os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run) + else: + os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run) else: print "\npython 2.5 not found, please install python 2.5 or 2.6 for fpdb\n" raw_input("Press ENTER to continue.") diff --git a/run_fpdb.py b/run_fpdb.py index 82cbb9b5..dd031403 100755 --- a/run_fpdb.py +++ b/run_fpdb.py @@ -27,5 +27,8 @@ os.chdir(sys.path[0]) #print "sys.path[0] =", sys.path[0], "cwd =", os.getcwd() -os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) +if os.name=='nt': + os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) +else: + os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run)