Mert Bora Alper added the comment:

> I think this was just overlooked when implementing argparse.  Most code out 
> there is likely to get the executable name using:
>
> os.path.basename(sys.argv[0])
>
> Which is going to do exactly what you are seeing here when sys.argv[0] ends 
> with a /.
> 
> feel free to submit a patch.  perhaps as simple as this?
>
>  os.path.basename(sys.argv[0].rstrip(os.path.sep))
>
> But I'd expect a bunch of other code out there to have the same problem.

It is exactly as you said: 
https://hg.python.org/cpython/file/3.4/Lib/argparse.py#l1619

Patch included. Created and tested using latest source at 
https://hg.python.org/cpython/.

----------
keywords: +patch
resolution:  -> fixed
Added file: http://bugs.python.org/file39120/argparse.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23994>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to