[Tutor] Verifying My Troublesome Linkage Claim between Python and Win7

Steven D'Aprano steve at pearwood.info
Sun Feb 28 02:24:03 CET 2010


Hello Wayne,

I sympathise with your problem, but please understand you are not making 
it easy for us when you give us incoherent information.

You tell us to "try this" and give a folder structure:

Folder1
    track1.py
    data1.txt
    data2.txt
    data3.txt
Folder2
    track1.py
    dset1.txt
    dset2.txt
    ...
    dset8.txt

but then when you send a copy of the actual code you are running, it is 
called "ReportingToolAwww.py" and it is 417 lines long. What happened 
to track1.py? What is in that? Does track1.py reproduce the fault?

There are five possible faults:

1  A problem in your Python code.
2  A serious bug in Python itself.
3  A serious bug in Windows file system.
4  Disk corruption making Windows confused.
5  A PEBCAK problem.

I can confirm that ReportingToolAwww.py doesn't seem to contain 
any "funny" path manipulations that would cause the problem: it simply 
calls open on relative path names, which will open files in the current 
directory. The problem does NOT appear to be in your Python code.

A serious bug in either Python or Windows is very unlikely. Not 
impossible, but unless somebody else reports that they too have seen 
the fault, we can dismiss them.

Disk corruption is possible. If all else fails, you can run the Windows 
disk utility to see if it finds anything.

But the most likely cause of the fault is that you aren't running what 
you think you are running. When you say:

"If I've created a shortcut, it wasn't by design. Ctrl-c to ctrl-v most 
likely."

"Most likely"? Meaning you're not sure?

Given that you are talking about the Properties window talking 
about "pointing to" things, I think it is very likely that in fact you 
have created a shortcut, or a symlink, and when you think you are 
running a copy in Folder2 you are actually running a shortcut to 
Folder1. That would *exactly* explain the problem you are experiencing.

Please take a screenshot of the Properties window showing the "pointing 
to" stuff. I think you will find that track1.py in Folder2 is a 
shortcut back to track1.py in Folder1.

(For the record, Windows does in fact have symlinks, as well as hard 
links and a third type of link called junction points. They are 
undersupported by Explorer, and so people hardly every use them. Most 
people don't even know they exist, even though some of them go back all 
the way to Windows NT. But as far as I can tell, there is no way for 
you to have created a symlink from Explorer.)


-- 
Steven D'Aprano


More information about the Tutor mailing list