Author hosford42
Recipients eryksun, hosford42, r.david.murray, serhiy.storchaka, steve.dower, tim.golden, zach.ware
Date 2014-10-24.19:30:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAD8ve4S5zMxis90SXstgGhV5cTisHR8UxjrDcKmf0pXPCrLVkQ@mail.gmail.com>
In-reply-to <CAD8ve4RC1-eHt6XJC5gL5LsHjWZ-YtAwY7LmsP6GG66Z1veykw@mail.gmail.com>
Content
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 <report@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 <report@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 <report@bugs.python.org>
> > <http://bugs.python.org/issue22719>
> > _______________________________________
> >
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue22719>
> _______________________________________
>
History
Date User Action Args
2014-10-24 19:30:31hosford42setrecipients: + hosford42, tim.golden, r.david.murray, zach.ware, serhiy.storchaka, eryksun, steve.dower
2014-10-24 19:30:31hosford42linkissue22719 messages
2014-10-24 19:30:31hosford42create