From: W. eWatson on
In the last day, I posted a message titled "What's Going on between
Python and win7?" I'd appreciate it if someone could verify my claim. A
sample program to do this is below. I'm using IDLE in Win7 with Py 2.5.

My claim is that if one creates a program in a folder that reads a file
in the folder it and then copies it to another folder, it will read the
data file in the first folder, and not a changed file in the new folder.
I'd appreciate it if some w7 users could try this, and let me know what
they find.

My experience is that if one checks the properties of the copied file,
it will point to the original py file and execute it and not the copy.


# Test program. Examine strange link in Python under Win7
# when copying py file to another folder.
# Call the program vefifywin7.py
# To verify my situation use IDLE, save and run this program there.
# Put this program into a folder along with a data file
# called verify.txt. Create a single text line with a few characters in it
# Run this program and note if the output
# Copy the program and txt file to another folder
# Change the contents of the txt file
# Run it again, and see if the output is the same as in the other folder
track_file = open("verify.txt")
aline = track_file.readline();
print aline
track_file.close()
From: Rick Dooling on
No telling what Windows will do. :)

I am a mere hobbyist programmer, but I think real programmers will
tell you that it is a bad habit to use relative paths. Use absolute
paths instead and remove all doubt.

http://docs.python.org/library/os.path.html

RD
From: W. eWatson on
On 2/23/2010 8:26 AM, Rick Dooling wrote:
> No telling what Windows will do. :)
>
> I am a mere hobbyist programmer, but I think real programmers will
> tell you that it is a bad habit to use relative paths. Use absolute
> paths instead and remove all doubt.
>
> http://docs.python.org/library/os.path.html
>
> RD
You may be right. The actual 300 line program just reads the folder
without specifying any path. I'm not that familiar with os path, but
have seen it used.
From: Gib Bogle on
Rick Dooling wrote:
> No telling what Windows will do. :)

It isn't useful to respond to a serious question with OS bigotry.
From: Gib Bogle on
W. eWatson wrote:
> On 2/23/2010 8:26 AM, Rick Dooling wrote:
>> No telling what Windows will do. :)
>>
>> I am a mere hobbyist programmer, but I think real programmers will
>> tell you that it is a bad habit to use relative paths. Use absolute
>> paths instead and remove all doubt.
>>
>> http://docs.python.org/library/os.path.html
>>
>> RD
> You may be right. The actual 300 line program just reads the folder
> without specifying any path. I'm not that familiar with os path, but
> have seen it used.

How do you invoke the program? Do you use a Command Prompt window?