[Python-au] python library to discover file associations
bgg at object-craft.com.au
Tue Feb 22 03:20:00 UTC 2011
On 22/02/2011, at 13:36, Mike Dewhirst wrote:
> Here is my code ...
> if obj.main():
> cmd = '%s' % obj.logname
> subprocess.Popen(cmd, shell=True).wait()
> ... which now works without error unless obj.logname has a non-specific filename extension. At that point I get ...
> File "subprocess.pyo", line 486, in call
> File "subprocess.pyo", line 672, in __init__
> File "subprocess.pyo", line 882, in _execute_child
> WindowsError: [Error 193] %1 is not a valid Win32 application
> I think I'll put that in a try block and if I detect any such OSError I'll take a stab with Notepad on Windows or Nano on Linux.
> What should I try for on Mac?
On Linux or mac you probably should be using the environment variable EDITOR, that way people can change it if they want to.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3589 bytes
Desc: not available
More information about the python-au