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

Wayne Watson sierra_mtnview at sbcglobal.net
Sat Feb 27 21:29:16 CET 2010


See below.

On 2/27/2010 10:58 AM, Steven D'Aprano wrote:
> On Sun, 28 Feb 2010 05:30:49 am Wayne Watson wrote:
>    
>> Ok, I'm back after a three day trip. You are correct about the use of
>> pronouns and a few misplaced words. I should have reread what I
>> wrote. I had described this in better detail elsewhere, and followed
>> that description with the request here probably thinking back to it.
>> I think I was getting a bit weary of trying to find an answer. Try
>> this.
>>
>>
>> Folder1
>>      track1.py
>>     data1.txt
>>     data2.txt
>>     data3.txt
>>
>> Folder2
>>      track1.py
>>      dset1.txt
>>      dset2.txt
>>      ...
>>      dset8.txt
>>
>> data and dset files have the same record formats. track1.py was
>> copied into  Folder2 with ctrl-c + ctrl-v. When I run track1.py from
>> folder1, it clearly has examined the data.txt  files. If I run the
>> copy of track1.py in folder2, it clearly operates on folder1 (one)
>> data.txt files. This should not be.
>>      
> Without seeing the code in track1.py, we cannot judge whether it should
> be or not. I can think of lots of reasons why it should be. For
> example:
>    
I'll attach the code to this. However, I haven't had the best of luck 
getting attachments posted. Frankly, I think it's better to try the 
sample program I provided at the top of the thread. If you are not using 
Win7, I don't think this is going to work well, but maybe you'll see 
something that's a no-no in any OS. I have several data files, if anyone 
wants to go that far. I can supply a data file if necessary.  Note this 
program is still in development. In fact, I was going to pull the debug 
"wtw" statements and wrap it all up when this problem occurred.
> if you have hard-coded the path to Folder1
>
> if you call os.chdir(Folder1)
>    
Not to my knowledge. I just "assume" that the program will read the txt 
files in alpha order in the same folder as the program.
> if you have changed the PATH so that Folder1 gets searched before the
> current directory
>
> then the behaviour you describe theoretically could happen.
>
> How are you calling track1.py? Do you do this?
>
>    cd Folder2
>    python track1.py
>    
Yes, I believe I've tried that.
> What if you change the second line to:
>
>    python ./track1.py
>
> Are you perhaps using this?
>
>    python -m track1
>    
Don't even know what it means.
> If you change the name of the copy from track1.py to copy_of_track1.py,
> and then call this:
>
>    python copy_of_track1.py
>
> how does the behaviour change?
>    
I'll try it later. I probably have tried it already. See my "point" 
comments below. If Properties doesn't change, changing the name isn't 
going to work.
>
>    
>> If I look at  the  properties of track1.py in folder2  (two), it  is
>> pointing back to the program in folder1 (one).
>>      
> What? "Pointing back", as in a Shortcut? Or a symlink?
>    
Aren't symlinks Linux world? I know nothing about them. Windows7
Properties of track1.py in folder 2 (two) show the py file is really in 
folder1.
> If you've created a shortcut instead of a copy, I'm not surprised you
> are executing it in the "wrong" folder. That's what shortcuts do.
>    
If I've created a shortcut, it wasn't by design. Ctrl-c to ctrl-v most 
likely.
>
>
>    

-- 
             "There is nothing so annoying as to have two people
              talking when you're busy interrupting." -- Mark Twain

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ReportingToolAww.py
URL: <http://mail.python.org/pipermail/tutor/attachments/20100227/ec1aeea1/attachment.ksh>


More information about the Tutor mailing list