<meta charset="utf-8">Hi All<div><br></div><div>Try this;</div><div><br></div><div>import subprocess</div><div>subprocess.Popen('txtfile.txt", shell=True).wait()</div><div><div><br></div><div>This "should" open the file using the default association and then wait (.wait) for that app to close before continuing your code :-)</div>
<div><br></div><div>Cheers</div><div>Warwick</div></div><br><div class="gmail_quote">On 21 February 2011 22:23, Eric O'Donnell <span dir="ltr"><<a href="mailto:svvampy@gmail.com">svvampy@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Mike,<br><br>If calling 'os.system(txtfile)' is not sufficient, in Windows you can trek through the registry.<br>
<br>First HKEY_CLASSES_ROOT\.txt which points you to the 'txtfile' entry.<br>Then HKEY_CLASSES_ROOT\txtfile\shell\open\command<br>
the value on my system is:<br>%SystemRoot%\system32\NOTEPAD.EXE %1<br><br>I don't know what you need to do on other platforms, perhaps look at the code for os.system?<br><br>Hmm, I just tried that via Cygwin:<br>>>> import os<br>
>>> <a href="http://os.name" target="_blank">os.name</a><br>'posix'<br>>>> os.system('file.txt')<br>sh: file.txt: command not found<br>32512<br>>>><br><br>So maybe that's not as helpful as I thought.<br>
<br>Cheers,<br>Eric<br><br>On 21 February 2011 17:31, Mike Dewhirst <span dir="ltr"><<a href="mailto:miked@dewhirst.com.au" target="_blank">miked@dewhirst.com.au</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
I want to launch the system text editor with a known text file but I don't know what that editor might be on which platform.<br>
<br>
Is there a Python library which can discover the system text editor on any platform?<br>
<br>
TIA<br>
<br>
Mike<br>
<br>
_______________________________________________<br>
python-au maillist - <a href="mailto:python-au@starship.python.net" target="_blank">python-au@starship.python.net</a><br>
<a href="http://starship.python.net/mailman/listinfo/python-au" target="_blank">http://starship.python.net/mailman/listinfo/python-au</a><br>
</blockquote></div><br>
<br>_______________________________________________<br>
python-au maillist - <a href="mailto:python-au@starship.python.net">python-au@starship.python.net</a><br>
<a href="http://starship.python.net/mailman/listinfo/python-au" target="_blank">http://starship.python.net/mailman/listinfo/python-au</a><br>
<br></blockquote></div><br>