This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author wfatp
Recipients wfatp
Date 2013-07-09.23:17:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1373411839.5.0.624696172952.issue18419@psf.upfronthosting.co.za>
In-reply-to
Content
Basically in a lot of situations in recent times I've had to make sure a bunch of files are all the same. Now diff is great but it only lets me pass two files. diff3 and sdiff also aren't what I'm looking for. So I decided to write my own little script that does that.

I was doing a few crude preliminary tests on an early version of the utility and that's when shit hit the fan. For reasons I can't explain Python 2.7.5 in some circumstances said that getstatusoutput wasn't an attribute of the commands module. The program executed fine though under Python 3.3.2.

Anyway here's some shell output which will leave you folks scratching your head as much as I am. I have several times checked the syntax and I just simply don't think I'm doing anything wrong. What are your thoughts?

=======SHELL OUTPUT=======

[georgiy@PANTHER mess]$ python
Python 2.7.5 (default, May 16 2013, 13:44:12) 
[GCC 4.8.0 20130412 (Red Hat 4.8.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import commands as run
>>> run.getstatusoutput
<function getstatusoutput at 0x247a9b0>
>>> 
[georgiy@PANTHER mess]$ python3
Python 3.3.2 (default, May 20 2013, 12:05:55) 
[GCC 4.8.0 20130412 (Red Hat 4.8.0-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess as run
>>> run.getstatusoutput
<function getstatusoutput at 0x7f5880225ef0>
>>> 
[georgiy@PANTHER mess]$ cat allthesame.py 
import sys
if sys.version_info==2:
	import commands as run
else:
	import subprocess as run
baseCommand='diff --recursive '+sys.argv[1]+' '
for item in sys.argv[2:]:
	if run.getstatusoutput(baseCommand+item)[0]!=0:
		print('not all the same')
		exit(1)
print('all the same')
exit(0)
[georgiy@PANTHER mess]$ cat a
test
[georgiy@PANTHER mess]$ cat b
test
[georgiy@PANTHER mess]$ python allthesame.py a b
Traceback (most recent call last):
  File "allthesame.py", line 8, in <module>
    if run.getstatusoutput(baseCommand+item)[0]!=0:
AttributeError: 'module' object has no attribute 'getstatusoutput'
[georgiy@PANTHER mess]$ python3 allthesame.py a b
all the same
History
Date User Action Args
2013-07-09 23:17:19wfatpsetrecipients: + wfatp
2013-07-09 23:17:19wfatpsetmessageid: <1373411839.5.0.624696172952.issue18419@psf.upfronthosting.co.za>
2013-07-09 23:17:19wfatplinkissue18419 messages
2013-07-09 23:17:19wfatpcreate