socket.sethostname() error type mistake
![](https://secure.gravatar.com/avatar/2e4a6d3a5ec43013d6927dba7d1d2887.jpg?s=120&d=mm&r=g)
Hi, I believe there is a mistake in the type of error raised by socket.sethostname(). The documentation says the error returned is OSError. Here is what I get (3.3.2): [16:39:sys] % python3 Python 3.3.2 (default, Aug 5 2013, 11:52:10) [GCC 4.5.3] on linux Type "help", "copyright", "credits" or "license" for more information.
import socket as s s.sethostname('bla') Traceback (most recent call last): File "<stdin>", line 1, in <module> PermissionError: [Errno 1] Operation not permitted
Simeon
![](https://secure.gravatar.com/avatar/7775d42d960a69e98fecf270bdeb6f57.jpg?s=120&d=mm&r=g)
PermissionError is subclass of OSError. There are outer possible errors by socket.sethostname() call, so doc is correct. On Mon, Aug 12, 2013 at 6:42 PM, Simeon S <simeon.simeonov.s@gmail.com> wrote:
Hi,
I believe there is a mistake in the type of error raised by socket.sethostname(). The documentation says the error returned is OSError. Here is what I get (3.3.2):
[16:39:sys] % python3 Python 3.3.2 (default, Aug 5 2013, 11:52:10) [GCC 4.5.3] on linux Type "help", "copyright", "credits" or "license" for more information.
import socket as s s.sethostname('bla') Traceback (most recent call last): File "<stdin>", line 1, in <module> PermissionError: [Errno 1] Operation not permitted
Simeon _______________________________________________ docs mailing list docs@python.org https://mail.python.org/mailman/listinfo/docs
-- Thanks, Andrew Svetlov
participants (2)
-
Andrew Svetlov
-
Simeon S