[Tutor] [OT] Re: os.path.exists(path) returns false when the path actually exists!

Luke Paireepinart rabidpoobear at gmail.com
Fri Aug 3 15:23:18 CEST 2007


>
>> I don't want to have to know the details of what makes my car run.  All I
>> want to do is drive it from one location to another.
>>     
>
> And one day your car doesn't start. So you blindly take it to a car mechanic 
> (or even the dealership~shudder) where they hook it up to a battery charger, 
> send it back and charge you $300. Right. Not important to you. I wish I 
> could throw away that kind of security.
>   
That's not really the same at all.
In the context of a large company, there is almost definitely
an IT staff on retainer set up to fix the computers at all times with no 
cost to the individual.
So the finance people's computer breaks, and someone comes to fix it for 
them.

Yes, you could argue that if the staff were trained enough, the IT 
department wouldn't need to be as large, etc. etc.
but the basic fact is that there are certain people who it's not 
cost-effective for companies to train to the level where they can fix 
any problem that arises in their use of the computer, and it's much 
cheaper to just train one guy (who can learn quickly) how to do the 
repairs quickly and efficiently and then have everyone defer to him.

>>> It is because these people do not wish to learn, do not have the
>>> capacity,
>>>       
>> Why should they have to learn?  They just want to use the spreadsheet, for
>> example.  Why should they have to learn that the magic sequence of ".XLS",
>> when appended to a file name, make the file work a certain way?  In most
>> contexts, the name of a thing does not determine how it works.  The name
>> is just a name.
>>     
>
> Why? Because it's a good idea. The name of the thing does not determine how 
> it works. But it does determine how it works in Windows. I do not expect 
> them to understand *why* the magic sequence of .xls causing this file to 
> open in Excel. I expect them to overlook it. I expect them to accept them. I 
> do not think it's appropriate that Microsoft should baby them by hiding the 
> extensions by default.
>   
I think this is similar to the backslash thing in Windows.
First-time Windows developers get tripped up because backslashes are the 
chosen escape-sequence for strings, to encode ascii values in them.
But forward-slashes could've been the escape sequence too.  It's pretty 
arbitrary.  They used backslashes in DOS, so they continued to use them 
in future versions of their OS.
Or the carriage returns.  \r means return to the beginning of the line, 
\n means go to the next line.  So \r\n is a logical way to make a 
backslash, because it goes to the next line, and returns to the 
beginning (so you don't start typing off in space.)  That's how Windows 
does it, but *nix does it using just \n, and Mac does it using just \r.  
People argue that Windows' way of doing it is worse, but really, it 
makes the most sense as far as the ascii control codes go.  Yes, it's a 
few characters longer, but it's mostly irrelevant.
Then, for file extensions: Microsoft chose to use file extensions to 
determine which program would run a given type of file.

All of these things could be considered design flaws, but the point is 
that they were used in every version of Microsoft's operating system, 
and thus they need to continue to be consistent, or a whole lot of 
software will break.

So Microsoft realizes that a majority of their users don't need to see 
the extensions.  So they hide them by default in the GUI.

That doesn't mean that developers don't have access to the full 
filename.  Sure we do.  It doesn't affect how our programs run.  The 
only fault is believing that the GUI is a completely accurate 
representation of the filesystem.  Which it's not.
You might say "OH, BUT IT SHOULD BE!"
well, when you're using a GUI file browser on a Linux system, it may not 
show you the write permissions to every file and directory.
Or it may not differentiate between symbolic links and actual files.  
That's because, to the extent that the GUI is used, this knowledge is 
largely unnecessary.  If you try to delete a file you don't have 
permission to, a little popup will come up saying "Sorry, you don't have 
permission to delete this file!"

As for Windows, it may be easier for people to see launching a shortcut 
to 'Notepad' and then clicking 'File > Open' and choosing their file as 
analogous to just double-clicking the file in their GUI.  And in this 
environment, this is represented by an icon of a notepad, just as the 
'Notepad' shortcut is.
Do you think that the 'Notepad' shortcut should say 
"%SystemRoot%\system32\notepad.exe" instead?
I think that would confuse a lot of people!

So a developer gets confused about the file path.  This is an 
unfortunate side-effect.  But if thousands of people find the computer 
more accessible in exchange for one developer getting confused and then 
realizing his mistake and never making it again, well, the choice is 
obviously (from a business standpoint) to hide the extension.
>> I suppose I could have a television that would require me to know to tune
>> it to a frequency of about 69Mhz to watch a particular program; but it's
>> just so much more convenient to me to turn to channel 4.  I see that
>> hiding of the technical details as an improvement, not a hindrance.
>>     
>
> Did I say I wanted people to know just what extension is what? Did I say 
> that they have to parse the .xls file for Excel? No. I ask that they learn 
> to accept it. Just like I would ask them to accept a slip of paper taped to 
> the TV that lists all of the frequencies mapped to the channels. I would not 
> ask them to use the table of frequencies to tune the TV. They may use the 
> channels. But the table would be there, visible, not hidden away where 
> potentially someone who needs it might not be able to find it.
>   
And should my stereo system come with a manual attached to it at all 
times that details soldering transistors and an explanation of 
electrical theory?
Your argument can be extended to gross extremes, and it doesn't hold up.
The interface I use to interact with my stereo, a system of knobs and 
such, is what I need to know in order to get my stereo to do what I need 
it to.  If it breaks, maybe I go buy a service manual and fix it, or 
maybe I recognize that the time it would take me to learn the 
intricacies of the electronics is greater than the cost if I have a 
professional fix it.
But largely, I just need to understand the interface.  Not the technical 
implementation.

Note that I just don't like your argument, not that I disagree with you.
> On the other hand, do you want a neural transmitter installed in you so that 
> you can more easily change the channel? Hey ~ you wouldn't even have to know 
> which channel you want to watch. All you would have to do is know *what* you 
> want to watch. Wouldn't that be excellent? It's like looking all over the 
> living room for the TV remote because you don't know how to change the 
> channel using the TV.
>   
You know, I can see a lot of people going for that.  Hey, if I could 
just hook directly to a computer and 'think' what I wanted to program, 
and I didn't have to rapidly press a series of buttons for the computer 
to understand me, I'd be all for it.  (The assumption here is that it's 
safe, etc.)

But that's not the issue here.
The reason you hate the extension-hiding is because it makes interacting 
with the computer at a lower level than the GUI confusing to you, when 
you are viewing the system at the level of the GUI.
If you view the system at the same level as you're interacting with it, 
there is no issue here.

That's the key idea.  You're making faulty assumptions based on a view 
of the filesystem that's different from the view your program sees when 
it's running. Base your view on what your program sees and there will be 
no problem.
>> Why should people adapt themselves to software instead of having the
>> software adapt to them?  I'm cribbing a bit from George Bernard Shaw here,
>> who wrote something like, "The reasonable man adapts to the world; the
>> unreasonable man adapts the world to himself.  Therefore, all progress
>> depends on the unreasonable man."
>>     
>
> Why should computer people have to adapt to user-friendly software?
>   
Because you (singular) program the software for them (plural.) There are 
more users than developers.  They are the ones who need to understand it.

Why should the computer have to be able to compile your C++ code or 
interpret your Python code?  Why shouldn't you have to speak to it in 
machine language?
Terry's quote embodies these.  The early Computer Science pioneers were 
disdainful of FORTRAN.  "It'll never be able to craft assembly that's 
nearly as efficient as what WE write by hand."  Then it turned out it 
did.  Then when Python came along, some C programmers were heard saying 
"Ah, but it'll never run as fast as our C programs will!"  But then the 
world came to realize that the fact remains that the computers are 
constantly increasing in speed of execution, and humans are not.  So 
we've reached the level where the shift occurs from increasing computing 
efficiency to increasing user efficiency.  And the more user-friendly 
the software is, the more user-efficient the resulting interaction will be.

P.S. Why don't I ever see Linux-bashing on this list?
-Luke


More information about the Tutor mailing list