Alan Gauld <alan.gauld <at> btinternet.com> writes:
> > How would you do this non programatically and not from the GUI? > In other words can you do it from an OS command line? Hello Alan, Thank you for your response. I want to do it from a GUI (with wxPython). I work with Windows XP SP3, python 2.5 and wxPython 2.8.9.2. subprocess.Popen(args = ["notepad", filename]) works fine. Same for subprocess.Popen(["C:\Program Files\Editra\Editra.exe", filename]). It opens the file with notepad or Editra without problems. subprocess.Popen("notepad") or subprocess.Popen("C:\Program Files\Editra\Editra.exe") work also fine. Conversely, subprocess.Popen("notepad++") doesn't work. If I do subprocess.Popen(args = ["notepad++", filename]), I get an exception. The exception is as follows: Traceback (most recent call last): File "<pyshell#22>", line 1, in <module> s.Popen(args = ["notepad++.exe", "c:\\Redirect.txt"]) File "C:\Python25\lib\subprocess.py", line 594, in __init__ errread, errwrite) File "C:\Python25\lib\subprocess.py", line 816, in _execute_child startupinfo) WindowsError: [Error 2] Le fichier spécifié est introuvable (the specified file cannot be found) I tried several other ways without any success: subprocess.Popen(args = ["notepad++.exe", filename]) subprocess.Popen(args = ["C:\Program Files\Notepad++\notepad++.exe", filename]) I wonder if it is due to the location of the softwares. Notepad.exe is located in C:\WINDOWS while notepad++ is located in C:\Program Files\Notepad++ >If not is thre an API to the editor, for example Windows editors >may have a COM interface that you could access. Do you mean that it is not always possible to open another software from python, notably if the software doesn't have a COM interface ? > > ed = os.getenv('EDITOR') > vi = os.getenv('VISUAL') os.getenv is always None, which may be correct since I am on Windows ? Thanks a lot for your help. Dominique _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor