[issue35367] FileExistsError During os.symlink() Displays Arrow in the Wrong Direction

2018-11-30 Thread Rich Jones


New submission from Rich Jones :

If I try to create a symlink which already exists, I get a FileExistsError. In 
this error message, the explanatory arrow is pointing in the wrong direction. 
This gave us a big scare in our logs!

Example:

```
$ ls
HELLO.txt
$ python3
Python 3.7.0 (default, Jul 23 2018, 20:22:55)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.symlink('HELLO.txt', 'GOODBYE.txt')
$ ls -lah *
lrwxr-xr-x  1 rjones  staff 9B Nov 30 15:36 GOODBYE.txt -> HELLO.txt
-rw-r--r--  1 rjones  staff 4B Nov 30 15:34 HELLO.txt
$ python3
Python 3.7.0 (default, Jul 23 2018, 20:22:55)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.symlink('HELLO.txt', 'GOODBYE.txt')
Traceback (most recent call last):
  File "", line 1, in 
FileExistsError: [Errno 17] File exists: 'HELLO.txt' -> 'GOODBYE.txt'
```

Notice that the arrow in the error message is pointing from HELLO to GOODBYE, 
but if you if you look at the `ls` output, it is pointing from GOODBYE to 
HELLO, which is the correct behavior.

The Python3 error message should be changed to reflect the correct direction of 
the symlink. 

This is a Python3 only bug, as the paths aren't displayed in Python2.

I can PR if this is accepted as a bug.

Thanks!
Rich

--
components: Library (Lib)
messages: 330826
nosy: miserlou
priority: normal
severity: normal
status: open
title: FileExistsError During os.symlink() Displays Arrow in the Wrong Direction
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 
<https://bugs.python.org/issue35367>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29657] os.symlink: FileExistsError shows wrong message

2018-11-30 Thread Rich Jones


Rich Jones  added the comment:

@Larry - that would be an acceptable solution!

I'm here because I encountered this error independently. I explain why the  
arrow is a problem here: https://bugs.python.org/issue35367

The issue is that the '->' notation is already used by the standard operating 
system utilities in this context, so for Python overload this semantically in 
this case is the source of all the confusion.

It would avoid the scare that we've all encountered if it just said 'src'/'dst' 
rather than '->'.

Thanks!
R

--
nosy: +miserlou

___
Python tracker 
<https://bugs.python.org/issue29657>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com