[Tutor] "Two" Card Monty with File Operations--Reading from Wrong Folder (W7?)
Wayne Watson
sierra_mtnview at sbcglobal.net
Mon Feb 22 04:29:38 CET 2010
I have a program called TrackStudy.py and another called ReportTool.py
Track runs above an Events folder that contains txt files that it
examines.Report runs in an Events folder on the same txt files. Neither
is operated when the other is operating. Both only read the same files.
I've been operating Report in another Events folder at another folder
level. Both work fine that way.
I decided to copy Report into the Event folder below Track. If I run
Track, it sees every txt file in Events. However, if I run Track, it
refers back to the other Events folder, and works fine even though on
the wrong set of files.
I've pretty much assumed by observation, that these programs read the
txt files in alphabetical order. It still seems the case.
There is one difference in Track on this. It uses:
paths = glob.glob(final_string)
to locate files. They always occur in the proper low to high sequence.
Report produces the wrong files in alpha order.
The question is why does Report see the folder in the wrong folder?
Although I think I've verified matters, I could be off. Is there a way
to ensure I'm really getting to the right folder? There may be a Win7
problem here. See below.
Here's a diagram that might help. Cap names means folder.
BINGO
EVENTS
a1.txt
a2.txt
report.py
CARDS
track.py
EVENTS
b1.txt
b2.txt
b3.txt
Now copy report.py to CARDS
BINGO
EVENTS
a1.txt
a2.txt
report.py
CARDS
track.py
EVENTS
b1.txt
b2.txt
b3.txt
report.py
While working on this problem, I came up with a Win7 puzzler. It amounts
to this. If I search for files in EVENTS of CARDS for "b", it only finds
one of the b-files. I had a long 1 hour talk with HP tech support. They
had no answer, but will take it up with MS. It may be related to the
first problem. Probably not, but curious. I suspect that Win7's new
folder search has somehow used a filter. I had no idea of any filter use
until I accidentally found it in W7 Help. Perhaps the filter was some
how set. Not by me.
Here's a stab in the dark. Maybe the copied report.py really is a
pointer to the other one?
--
"There is nothing so annoying as to have two people
talking when you're busy interrupting." -- Mark Twain
More information about the Tutor
mailing list