Aaron added the comment: If I use a separate temp variable, the bug doesn't show, but if I use the same variable, even with + instead of +=, it still happens.
>>> bak_path = r"C:\Users\EAARHOS\Desktop\Python Review\baseExcel.py" >>> print(os.stat(bak_path)) nt.stat_result(st_mode=33206, st_ino=8162774324652726, st_dev=0, st_nlink=1, st_uid=0, st_gid=0, st_size=29874, st_atime=1413389016, st_mtime=1413389016, st_ctime=1413388655) >>> temp = bak_path + '.bak' >>> bak_path = temp >>> print(os.stat(bak_path)) nt.stat_result(st_mode=33206, st_ino=42502721483352490, st_dev=0, st_nlink=1, st_uid=0, st_gid=0, st_size=29999, st_atime=1413389088, st_mtime=1413389088, st_ctime=1413388654) >>> temp = bak_path + '.bak' >>> bak_path = temp >>> print(os.stat(bak_path)) Traceback (most recent call last): File "<interactive input>", line 1, in <module> FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\EAARHOS\\Desktop\\Python Review\\baseExcel.py.bak.bak' >>> bak_path = r"C:\Users\EAARHOS\Desktop\Python Review\baseExcel.py" >>> bak_path = bak_path + '.bak' >>> print(os.stat(bak_path)) nt.stat_result(st_mode=33206, st_ino=42502721483352490, st_dev=0, st_nlink=1, st_uid=0, st_gid=0, st_size=29999, st_atime=1413389088, st_mtime=1413389088, st_ctime=1413388654) >>> bak_path = bak_path + '.bak' >>> print(os.stat(bak_path)) nt.stat_result(st_mode=33206, st_ino=42502721483352490, st_dev=0, st_nlink=1, st_uid=0, st_gid=0, st_size=29999, st_atime=1413389088, st_mtime=1413389088, st_ctime=1413388654) >>> bak_path = bak_path + '.bak' >>> print(os.stat(bak_path)) nt.stat_result(st_mode=33206, st_ino=42502721483352490, st_dev=0, st_nlink=1, st_uid=0, st_gid=0, st_size=29999, st_atime=1413389088, st_mtime=1413389088, st_ctime=1413388654) >>> bak_path = bak_path + '.bak' >>> print(os.stat(bak_path)) nt.stat_result(st_mode=33206, st_ino=42502721483352490, st_dev=0, st_nlink=1, st_uid=0, st_gid=0, st_size=29999, st_atime=1413389088, st_mtime=1413389088, st_ctime=1413388654) >>> On Fri, Oct 24, 2014 at 2:24 PM, Aaron <rep...@bugs.python.org> wrote: > > Aaron added the comment: > > Interesting. It continues to reuse the last one's stats once the path is no > longer valid. > > >>> bak_path = r"C:\Users\EAARHOS\Desktop\Python Review\baseExcel.py" > >>> print(os.stat(bak_path)) > nt.stat_result(st_mode=33206, st_ino=8162774324652726, st_dev=0, > st_nlink=1, st_uid=0, st_gid=0, st_size=29874, st_atime=1413389016, > st_mtime=1413389016, st_ctime=1413388655) > >>> bak_path += '.bak' > >>> print(os.stat(bak_path)) > nt.stat_result(st_mode=33206, st_ino=42502721483352490, st_dev=0, > st_nlink=1, st_uid=0, st_gid=0, st_size=29999, st_atime=1413389088, > st_mtime=1413389088, st_ctime=1413388654) > >>> bak_path += '.bak' > >>> print(os.stat(bak_path)) > nt.stat_result(st_mode=33206, st_ino=42502721483352490, st_dev=0, > st_nlink=1, st_uid=0, st_gid=0, st_size=29999, st_atime=1413389088, > st_mtime=1413389088, st_ctime=1413388654) > >>> bak_path += '.bak' > >>> print(os.stat(bak_path)) > nt.stat_result(st_mode=33206, st_ino=42502721483352490, st_dev=0, > st_nlink=1, st_uid=0, st_gid=0, st_size=29999, st_atime=1413389088, > st_mtime=1413389088, st_ctime=1413388654) > >>> bak_path += '.bak' > >>> print(os.stat(bak_path)) > nt.stat_result(st_mode=33206, st_ino=42502721483352490, st_dev=0, > st_nlink=1, st_uid=0, st_gid=0, st_size=29999, st_atime=1413389088, > st_mtime=1413389088, st_ctime=1413388654) > >>> > > On Fri, Oct 24, 2014 at 1:49 PM, eryksun <rep...@bugs.python.org> wrote: > > > > > eryksun added the comment: > > > > What do you get for os.stat? > > > > bak_path = r"C:\Users\EAARHOS\Desktop\Python Review\baseExcel.py" > > print(os.stat(bak_path)) > > bak_path += '.bak' > > print(os.stat(bak_path)) > > bak_path += '.bak' > > print(os.stat(bak_path)) # This should raise FileNotFoundError > > > > ---------- > > nosy: +eryksun > > > > _______________________________________ > > Python tracker <rep...@bugs.python.org> > > <http://bugs.python.org/issue22719> > > _______________________________________ > > > > ---------- > > _______________________________________ > Python tracker <rep...@bugs.python.org> > <http://bugs.python.org/issue22719> > _______________________________________ > ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22719> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com