homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Misleading error on creating already existed symlink
Type: behavior Stage: resolved
Components: Extension Modules, Windows Versions: Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Bad error message in os.rename, os.link, and os.symlink
View: 16074
Assigned To: Nosy List: serhiy.storchaka, vajrasky
Priority: normal Keywords: patch

Created on 2013年12月01日 09:57 by vajrasky, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fix_error_message_on_creating_already_existed_symbolic_link.patch vajrasky, 2013年12月01日 09:57 review
fix_python_33_windows_create_existed_symlink.patch vajrasky, 2013年12月01日 14:10 Python 3.3 review
Messages (5)
msg204899 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013年12月01日 09:57
Steps to reproduce the bug:
1. Download cute cat picture from internet. Name it CuteCat.jpg.
>>> import os
>>> os.listdir('.')
['CuteCat.jpg']
2. Create symbolic link.
>>> os.symlink('CuteCat.jpg', 'Aaawww.lnk')
>>> os.listdir('.')
['Aaawww.lnk', 'CuteCat.jpg']
3. Do it again.
>>> os.symlink('CuteCat.jpg', 'Aaawww.lnk')
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
FileExistsError: [Errno 17] File exists: 'CuteCat.jpg'
Amusingly, it only happens on 3.4 (both Windows and Linux). 3.3 gives correct error message (in Linux, I did not test it on Windows). 2.7 omits the file information (in Linux, I did not test it on Windows). I'll check again the behaviour on Windows for 2.7 and 3.3.
Do we need unit test for this? Will we change the error message again in the future? For now, I omit it. Let me know if we need unit test.
msg204900 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013年12月01日 10:04
Python 2.7 on Windows does not have symlink.
Python 3.3 on Windows got the same symptom as Python 3.4. Do we need to fix it?
msg204919 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013年12月01日 14:10
This is the patch for Python 3.3.
msg204940 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013年12月01日 15:59
There are several similar issues on the tracker.
msg204943 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013年12月01日 16:08
See issue16074.
History
Date User Action Args
2022年04月11日 14:57:54adminsetgithub: 64047
2013年12月01日 20:56:47Arfreversetnosy: - Arfrever
2013年12月01日 16:08:13serhiy.storchakasetstatus: open -> closed
superseder: Bad error message in os.rename, os.link, and os.symlink
messages: + msg204943

resolution: duplicate
stage: resolved
2013年12月01日 15:59:41serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg204940
2013年12月01日 14:55:55Arfreversetnosy: + Arfrever
2013年12月01日 14:10:26vajraskysetfiles: + fix_python_33_windows_create_existed_symlink.patch

messages: + msg204919
2013年12月01日 10:04:25vajraskysetmessages: + msg204900
2013年12月01日 09:57:54vajraskycreate

AltStyle によって変換されたページ (->オリジナル) /