Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'string.': 0.04; 'interpreter': 0.05; 'lines.': 0.05; 'one?': 0.05; 'subject:Python': 0.06; 'behavior.': 0.07; 'does.': 0.07; 'franklin': 0.07; 'tab': 0.07; 'python': 0.08; '"hello': 0.09; '>>>>': 0.09; 'finish.': 0.09; 'linux.': 0.09; 'reasonable.': 0.09; 'statement.': 0.09; 'url:github': 0.09; ';-)': 0.12; 'am,': 0.12; 'case.': 0.15; 'cc:addr:python-list': 0.15; '"r")': 0.16; '.py': 0.16; 'dave.': 0.16; 'different,': 0.16; 'feed.': 0.16; 'gene': 0.16; 'occasionally': 0.16; 'paths.': 0.16; 'pulled': 0.16; 'sequential': 0.16; 'soap,': 0.16; 'suggested,': 0.16; 'suggested.': 0.16; 'typo': 0.16; 'url:blob': 0.16; 'cheers,': 0.18; 'wrote:': 0.18; '>>>': 0.18; 'seems': 0.19; 'downloaded': 0.21; 'cc:no real name:2**0': 0.21; 'file,': 0.21; 'subject:please': 0.21; 'stuff': 0.22; "doesn't": 0.23; 'alpha': 0.23; 'itself,': 0.23; 'header:In-Reply-To:1': 0.23; 'changed': 0.24; 'suspect': 0.24; 'cc:2**0': 0.25; 'code': 0.25; 'statement': 0.25; 'code.': 0.26; 'code,': 0.27; 'putting': 0.27; 'compare': 0.28; 'version,': 0.28; 'forgot': 0.28; 'toward': 0.28; 'looks': 0.28; 'cc:addr:python.org': 0.29; 'print': 0.29; 'lines': 0.30; 'seem': 0.30; 'jones': 0.30; 'yes.': 0.30; "didn't": 0.30; 'least': 0.31; 'thanks': 0.31; 'quite': 0.32; "won't": 0.32; 'actually': 0.33; "i've": 0.33; 'it.': 0.33; 'header:User- Agent:1': 0.33; 'file.': 0.34; 'all.': 0.34; 'shows': 0.34; 'probably': 0.34; 'null': 0.34; "what's": 0.35; 'running': 0.35; 'file': 0.36; 'something': 0.36; 'page.': 0.36; 'another': 0.36; 'doing': 0.37; 'but': 0.37; 'issue': 0.37; 'not,': 0.37; 'using': 0.37; 'could': 0.38; 'monday,': 0.38; 'put': 0.38; 'perhaps': 0.38; 'skip:o 20': 0.38; "i'd": 0.39; 'absolute': 0.39; 'empty': 0.39; 'got': 0.39; 'subject:: ': 0.39; 'change': 0.39; 'data': 0.40; 'files': 0.40; 'did': 0.40; 'more': 0.60; 'per': 0.61; 'leading': 0.61; 'back': 0.62; '2011': 0.62; 'header:Message- Id:1': 0.62; 'feet': 0.64; 'here': 0.65; 'high': 0.66; 'bottom': 0.68; 'stand': 0.72; 'thousand': 0.73; 'with,': 0.77; '"there': 0.84; '15k': 0.84; '30k': 0.84; 'cow': 0.84; 'otten': 0.84; 'swag,': 0.84; 'received:66.118': 0.91; 'stretch': 0.91; 'yours.': 0.95 X-Spam-Status: No, score=-2.0 required=5.0 X-Spam-Level: From: gene heskett To: d@davea.name Subject: Re: Python lesson please Date: Mon, 7 Nov 2011 15:00:49 -0500 User-Agent: KMail/1.13.7 (Linux/2.6.38.8-pclos2.pae.bfs; KDE/4.6.5; i686; ; ) References: <201111061314.43744.gheskett@wdtv.com> <201111071140.12374.gheskett@wdtv.com> <4EB8201A.6080401@davea.name> In-Reply-To: <4EB8201A.6080401@davea.name> MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1256" Content-Transfer-Encoding: 7bit Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 121 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1320696059 news.xs4all.nl 6896 [2001:888:2000:d::a6]:56898 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:15430 On Monday, November 07, 2011 02:43:11 PM Dave Angel did opine: > On 11/07/2011 11:40 AM, gene heskett wrote: > > On Monday, November 07, 2011 11:30:45 AM Dave Angel did opine: > > Back on the list.. > > > >> On 11/07/2011 06:22 AM, gene heskett wrote: > >>> On Monday, November 07, 2011 05:35:15 AM Peter Otten did opine: > >>> > >>> > >>>> Are you talking about this one? > >>>> > >>>> https://github.com/halsten/Duqu-detectors/blob/master/DuquDriverPat > >>>> te rns .py > >>> > >>> Yes. My save as renamed it, still has about 30k of tabs in it. But > >>> I pulled it again, using the 'raw' link, saved it, no extra tabs. > >>> > >>> But it still doesn't work for linux. My python is 2.6.6 > >> > >> To start with, what's the md5 of the file you downloaded and are > >> testing? I get c4592a187f8f7880d3b685537e3bf9a5 > > > > [root@coyote Download]# md5sum DuquDriverPatterns.py > > c4592a187f8f7880d3b685537e3bf9a5 DuquDriverPatterns.py, same as > > yours. > > > >> from md5sum. If you get something different, one of us changed the > >> file, or you got it before today. > >> > >> The whole tab issue is a red-herring in this case. But I don't see > >> how you can find 30k tabs in a thousand lines. And if I were going > >> to detab it, I'd pick 4 spaces, so the code doesn't stretch across > >> the page. > > > > Down toward the bottom of the file, the tab indentations were as high > > as 33 leading tabs per line. Each stanza of the data was tab > > indented 2 additional tabs from the one above it in the original > > file. 30k was perhaps a poor SWAG, but 10 to 15k seems an entirely > > reasonable guess. > > What program are you using to read the file and support that claim? vim. But remember, this first one started out as a copy/paste from the firefox-7.0.1 screen. > Neither emacs nor gedit shows more than one leading tab on any line I > looked. And if you set tabs to 4 columns, the file looks quite > reasonable. Doing a quick scan I see max of 5 tabs on any single line, > and 1006 total. I have no tabs left in the operative code, the python interpreter was having a cow if even one was in that last 30-35 lines of code. > > > maxtabs = 0 > totaltabs = 0 > f = open("DuquDriverPatterns.py", "r") > for line in f: > > cline = line.replace("\t", "") > tabs = len(line) - len(cline) > if tabs: > print tabs > maxtabs = max(maxtabs, tabs) > totaltabs += tabs > > print "max=", maxtabs > print "total=", totaltabs > > >>> > The only way I've been able to make it "silent and instant" was to give > it the name of an empty directory, or a typo representing no directory > at all. > [...] > >> line ? Or putting a print len(files) just after it (indented, of > >> course) ? > > > > No, I did try to print the value of rootdir though, indented the same, > > and got a null printout, not even a line feed. Indented the same as the rootdir statement itself, which in python would seem to make it immediately sequential to the roodir = statement. > If you had put the print I suggested, it would at least print the words > "Hello World". Since it did not, you probably didn't actually add the > line where I suggested. > > > Thanks Dave. > > > > Cheers, Gene > > In another message you said it doesn't work on absolute file paths. But > it does. You can replace any relative directory name with the absolute > version, and it won't change the behavior. I suspect you were caught up > by a typo for the absolute path string. I am gene, running as gene, what could be wrong with giving it /home/gene as the argument? I have another dir in /home/amanda, that I build the alpha and beta amanda stuff in. Let me try that. And again, this works but I forgot about the .ccache directory, so it will take a while to finish. Now, as a python lesson to me, I will do a blink compare between the 2 files this evening & see what I munged. ATM, I am working on a gunstock for as long as my feet and back can stand the standing, so sitting here is a 'break' from that. Yeah, I occasionally call myself a JOAT. ;-) Thanks Dave. Cheers, Gene -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) My web page: Experience is that marvelous thing that enables you recognize a mistake when you make it again. -- Franklin P. Jones