Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.maint.python > #11418
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Artem Golubev <agolubev.n@gmail.com> |
| Newsgroups | linux.debian.maint.python |
| Subject | AttributeError: module 'socket' has no attribute 'timeout' |
| Date | Thu, 25 Apr 2019 09:30:01 +0200 |
| Message-ID | <xQGZr-3fY-3@gated-at.bofh.it> (permalink) |
| X-Original-To | "debian-python@lists.debian.org" <debian-python@lists.debian.org> |
| X-Mailbox-Line | From debian-python-request@lists.debian.org Thu Apr 25 07:21:08 2019 |
| Old-Return-Path | <agolubev.n@gmail.com> |
| X-Amavis-Spam-Status | No, score=1.401 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, BODY_8BITS=1.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FOURLA=0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=no autolearn_force=no |
| X-Policyd-Weight | using cached result; rate: -5.5 |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=63oGw2qY1UPEIs5nZNB9roxrpRay8YfrM2UbvjZi6t0=; b=POahcjCis2RmAbKtj/Xgb9j0FUPlNDaMAP7bzNFc/SIYnlqh1N5K8XyZ6d8VP0H5+a KqXcGwIXpGRLLuxlduNEQZDlUFTmZnszTc4QVEN14AC0iL94lTyT19VGweWEMLtRYNu2 +ioamUEpA+TxuBW0KAqc49mCRsmJkm7vKq3hGp4Q0DSSDLTr9y1tZXu0s43pdiFL47GS a0KdOhApkdFfIAAMNXvZT80fMtYABsxIjMvjJga/03lLJqddNYckLzzs5GieECffCXzN w23XMbEPLhnsU79jnAg2JcC9BeKPqDhv8jcd09nFmF7nLKhkJadoxVhg/xx/CisGtvT8 F82Q== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=63oGw2qY1UPEIs5nZNB9roxrpRay8YfrM2UbvjZi6t0=; b=ZyNETNo9J8colt6dRCOBuMiTPjdx0SeTJjLTHDZ9/VuKXVkOXa1AV8g+kUI2Dr2P02 izLOKnlSqapj9XXt17EAblgU9ArJSn1+N3XEhV3sJ4h+bD2nL7t6mZNyVGcwqrL/l+GH SMdb5B9I3WpeamHDAyHgJk9z9VscHhsuU5vsNZ/03vrETRjcdK1/yKc2Cd9zc4afhxoo Ypl58hPGe08sW/8AzNSt22k1lELjCdjd6gYwXYVW83Ez0U9JP/fKr0Mi34nWwXG9Ik2h 7z5Uc4T83hAvWvHmzvRtJli3Zp4qF6ZPadtvnEmTkpO4gJG55gjIrF4ScIFVeVQ4Ev6W u0Iw== |
| X-Gm-Message-State | APjAAAWpcjzbDfII0DqZirHEwxXB+kNKH/8/9oGOU0LnM8YA/A1C4mpi 2glKD2B53hTJ1ifhKJsS9NxiRmL8DcCiRup3mmNH5Q== |
| X-Google-SMTP-Source | APXvYqwcMP0H3V28qZbZhJZxo1CqaxEnWS/yVA8dWlN2Z2B/uJuXy3nRfXSBf/Z09tWpm/YFFfMVgiILwo2ZWqySVkQ= |
| X-Received | by 2002:a19:9792:: with SMTP id z140mr2223217lfd.75.1556175897475; Thu, 25 Apr 2019 00:04:57 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | multipart/alternative; boundary="00000000000093c3fa0587556f2f" |
| X-Mailing-List | <debian-python@lists.debian.org> archive/latest/16891 |
| List-ID | <debian-python.lists.debian.org> |
| List-URL | <https://lists.debian.org/debian-python/> |
| List-Archive | https://lists.debian.org/msgid-search/CAB+BSg_YBw+a2L2+PnNoM1MWq+6tGgcJ=Eyo_g0ZC_J2sTLEbw@mail.gmail.com |
| Approved | robomod@news.nic.it |
| Lines | 99 |
| Organization | linux.* mail to news gateway |
| Sender | robomod@news.nic.it |
| X-Original-Date | Thu, 25 Apr 2019 10:04:46 +0300 |
| X-Original-Message-ID | <CAB+BSg_YBw+a2L2+PnNoM1MWq+6tGgcJ=Eyo_g0ZC_J2sTLEbw@mail.gmail.com> |
| Xref | csiph.com linux.debian.maint.python:11418 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Hello, I’m using python3.5, python3.7 on Debian 9 stretch
This is my code:
———————-
import socket
host = 'google.com’
port = 80
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(0.1)
result = sock.connect_ex((host, port))
if result == 0:
print('Port is UP')
else:
print('Port is DOWN')
except socket.timeout as e:
print(e)
——————————
When I execute my code I receive this error
***************
Traceback (most recent call last):
File "/root/python/projects/test/socket.py", line 7, in <module>
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
AttributeError: module 'socket' has no attribute 'AF_INET'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "socket.py", line 1, in <module>
import socket
File "/root/python/projects/test/socket.py", line 14, in <module>
except socket.timeout as e:
AttributeError: module 'socket' has no attribute 'timeout'
******************
recently everything worked fine, but some time ago this error appeared.
And on other OS (Ubuntu, FreeBSD), the code works without errors. Please
help:) sorry for my English
--
С уважением,
Артём
Back to linux.debian.maint.python | Previous | Next — Next in thread | Find similar | Unroll thread
AttributeError: module 'socket' has no attribute 'timeout' Artem Golubev <agolubev.n@gmail.com> - 2019-04-25 09:30 +0200 Re: AttributeError: module 'socket' has no attribute 'timeout' Alexandros Afentoulis <alexaf@bloom.re> - 2019-04-25 10:20 +0200 Re: AttributeError: module 'socket' has no attribute 'timeout' Neil Williams <codehelp@debian.org> - 2019-04-25 10:20 +0200
csiph-web