strange behavior with os.system
Piet van Oostrum
piet at cs.uu.nl
Tue Jun 16 22:16:56 CEST 2009
>>>>> kmw <wuerzner at gmail.com> (k) wrote:
>k> I wanted to write a simple script (in 5 minutes or so) which replaces
>k> the option '+1' given to the command 'sort' by '-k 2' and than runs
>k> 'sort' with the modified argument list. After two hours I am giving up
>k> and ask you for help. This is what I tried (please excuse the verbose
>k> code, it is due to my various efforts to understand the error):
>k> Please note the unrequested output of '<type 'NoneType'>'. The strange
>k> thing about this all is the fact that the whole thing works as
>k> expected when typed into the interpreter. I would be glad if anyone
>k> could help.
MRAB has already given you some insight, I hope.
But are you aware that you are calling your own program again?
Or did you want to call the standard sort program? In that case you
shouldn't call ./sort as it is in argv, but just sort (assuming '.'
is not in your PATH) or the full path, like /usr/bin/sort.
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org
More information about the Python-list