[Python-au] python library to discover file associations

Mike Dewhirst miked at dewhirst.com.au
Tue Feb 22 04:43:49 UTC 2011


On 22/02/2011 2:20pm, Ben Golding wrote:
>
> 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.

Ben

On OpenSuSE 11.1 I have CSHEDIT=emacs but no EDITOR in env. I'm going to 
try Raf's suggestion now. It looks very nice.

Thanks

Mike


>
> Ben.




More information about the python-au mailing list