Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54812
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'charset:iso-8859-7': 0.04; 'expressions': 0.07; 'failing': 0.07; 'socket': 0.07; 'variables': 0.07; 'string': 0.09; 'properly.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'used.': 0.09; 'runs': 0.10; 'python': 0.11; '3.3,': 0.16; 'exist.': 0.16; 'illustrating': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:exception': 0.16; 'subject:expression': 0.16; '(you': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'server,': 0.19; '>>>': 0.22; 'import': 0.22; 'shell': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'header:X-Complaints-To:1': 0.27; 'installed': 0.27; "i'm": 0.30; 'code': 0.31; '"",': 0.31; 'file': 0.32; '(most': 0.33; 'basic': 0.35; 'display': 0.35; 'problem.': 0.35; 'skip:s 30': 0.35; 'prepare': 0.35; 'but': 0.35; 'representing': 0.36; 'should': 0.36; 'so,': 0.37; 'skip:o 20': 0.38; 'server': 0.38; 'question,': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'skip:o 30': 0.61; 'name': 0.63; 'dont': 0.67; 'default': 0.69; 'lack': 0.78; 'greek': 0.84; 'lien': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dave Angel <davea@davea.name> |
| Subject | Re: Handling 3 operands in an expression without raising an exception |
| Date | Thu, 26 Sep 2013 11:24:57 +0000 (UTC) |
| References | <l20njn$uhh$1@dont-email.me> <pan.2013.09.26.08.55.29.461000@nowhere.com> <l210c2$95b$1@dont-email.me> <mailman.345.1380190345.18130.python-list@python.org> <l211m1$f3b$1@dont-email.me> <mailman.348.1380192089.18130.python-list@python.org> <l213jr$p9j$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-7 |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | 174.32.174.35 |
| User-Agent | XPN/1.2.6 (Street Spirit ; Linux) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.350.1380194717.18130.python-list@python.org> (permalink) |
| Lines | 41 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1380194717 news.xs4all.nl 15895 [2001:888:2000:d::a6]:46666 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:54812 |
Show key headers only | View raw
On 26/9/2013 06:51, Νίκος wrote:
<SNIP>
>>>>> socket.gethostbyaddr( os.environ.get('HTTP_CF_CONNECTING_IP') or
>> os.environ.get('REMOTE_ADDR') or "Άγνωστη Προέλευση" )[0]
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> socket.gaierror: [Errno -2] Name or service not known
>>
>> You are just illustrating your lack of basic understaning.
>
> I'm surepirsed, becaus eon my domain [superhost.gr] the same lien of
> code works withnout an error and it display the 'host' fileds properly.
>
> Perhaps its failing via shell or you do not have a web server installed
> to prepare the enviromental variables or i dont know what else to hink.
>
> But in my website this code runs at the probelm with no problem.
>
In Python 3.3, but not on a web server, I get:
>>> import socket
>>> socket.gethostbyaddr("unknown")[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
socket.gaierror: [Errno -2] Name or service not known
>>>
Question, do you get the same result on your server? (You can put the
Greek string in place of "unknown" of course)
If so, then the default value makes no sense; it'll cause an exception
if it's ever used. If you insist on sticking to expressions (no
try/catch, no if statements), then perhaps you should default to a
string representing a domain which will always exist.
--
DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 10:26 +0300
Re: Handling 3 operands in an expression without raising an exception Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-09-26 10:48 +0300
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 10:51 +0300
Re: Handling 3 operands in an expression without raising an exception Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-09-26 11:12 +0300
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 11:39 +0300
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 11:46 +0300
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 11:50 +0300
Re: Handling 3 operands in an expression without raising an exception Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-09-26 12:20 +0300
Re: Handling 3 operands in an expression without raising an exception Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-09-26 12:04 +0300
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 12:45 +0300
Re: Handling 3 operands in an expression without raising an exception Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-26 11:07 +0200
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 12:31 +0300
Re: Handling 3 operands in an expression without raising an exception Maarten <maarten.sneep@knmi.nl> - 2013-09-26 02:52 -0700
Re: Handling 3 operands in an expression without raising an exception Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-26 12:01 +0200
Re: Handling 3 operands in an expression without raising an exception "James Harris" <james.harris.1@gmail.com> - 2013-09-26 11:53 +0100
Re: Handling 3 operands in an expression without raising an exception alex23 <wuwei23@gmail.com> - 2013-09-27 10:05 +1000
Re: Handling 3 operands in an expression without raising an exception Chris Angelico <rosuav@gmail.com> - 2013-09-26 18:41 +1000
Re: Handling 3 operands in an expression without raising an exception Tim Golden <mail@timgolden.me.uk> - 2013-09-26 09:47 +0100
Re: Handling 3 operands in an expression without raising an exception Nobody <nobody@nowhere.com> - 2013-09-26 09:55 +0100
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 12:56 +0300
Re: Handling 3 operands in an expression without raising an exception Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-26 12:12 +0200
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 13:18 +0300
Re: Handling 3 operands in an expression without raising an exception Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-26 12:41 +0200
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 13:51 +0300
Re: Handling 3 operands in an expression without raising an exception Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-26 13:07 +0200
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 14:25 +0300
Re: Handling 3 operands in an expression without raising an exception Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-26 13:47 +0200
Re: Handling 3 operands in an expression without raising an exception Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-26 14:42 +0000
Re: Handling 3 operands in an expression without raising an exception Dave Angel <davea@davea.name> - 2013-09-26 11:24 +0000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 15:39 +0300
Re: Handling 3 operands in an expression without raising an exception Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-26 14:53 +0200
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 16:34 +0300
Re: Handling 3 operands in an expression without raising an exception Dave Angel <davea@davea.name> - 2013-09-26 14:22 +0000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-26 19:58 +0300
Re: Handling 3 operands in an expression without raising an exception Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-26 20:16 +0000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-27 01:14 +0300
Re: Handling 3 operands in an expression without raising an exception Dave Angel <davea@davea.name> - 2013-09-26 22:55 +0000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-27 12:19 +0300
Re: Handling 3 operands in an expression without raising an exception Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-27 09:26 +0000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-27 13:04 +0300
Re: Handling 3 operands in an expression without raising an exception Dave Angel <davea@davea.name> - 2013-09-27 10:43 +0000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-27 14:15 +0300
Re: Handling 3 operands in an expression without raising an exception Dave Angel <davea@davea.name> - 2013-09-27 12:17 +0000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-27 15:51 +0300
Re: Handling 3 operands in an expression without raising an exception rusi <rustompmody@gmail.com> - 2013-09-28 10:29 -0700
Re: Handling 3 operands in an expression without raising an exception Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-27 15:16 +0000
Re: Handling 3 operands in an expression without raising an exception Grant Edwards <invalid@invalid.invalid> - 2013-09-27 16:04 +0000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-27 19:47 +0300
Re: Handling 3 operands in an expression without raising an exception Neil Cerutti <neilc@norwich.edu> - 2013-09-27 16:56 +0000
Re: Handling 3 operands in an expression without raising an exception Grant Edwards <invalid@invalid.invalid> - 2013-09-27 17:00 +0000
Re: Handling 3 operands in an expression without raising an exception Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-27 13:19 -0400
Re: Handling 3 operands in an expression without raising an exception Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-09-27 18:32 +0100
Re: Handling 3 operands in an expression without raising an exception Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-27 18:49 +0000
Re: Handling 3 operands in an expression without raising an exception Grant Edwards <invalid@invalid.invalid> - 2013-09-27 18:54 +0000
Re: Handling 3 operands in an expression without raising an exception Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-27 15:21 -0400
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-28 01:06 +0300
Re: Handling 3 operands in an expression without raising an exception Dave Angel <davea@davea.name> - 2013-09-27 22:26 +0000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-28 12:33 +0300
Re: Handling 3 operands in an expression without raising an exception Chris Angelico <rosuav@gmail.com> - 2013-09-28 20:19 +1000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-28 16:23 +0300
Re: Handling 3 operands in an expression without raising an exception Andreas Perstinger <andipersti@gmail.com> - 2013-09-28 17:02 +0200
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-28 19:14 +0300
Re: Handling 3 operands in an expression without raising an exception Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-09-28 18:53 +0100
Re: Handling 3 operands in an expression without raising an exception Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-28 14:21 -0400
Re: Handling 3 operands in an expression without raising an exception Zero Piraeus <z@etiol.net> - 2013-09-28 15:38 -0300
Re: Handling 3 operands in an expression without raising an exception Neil Cerutti <neilc@norwich.edu> - 2013-09-30 11:32 +0000
Re: Handling 3 operands in an expression without raising an exception Chris Angelico <rosuav@gmail.com> - 2013-09-30 21:53 +1000
Re: Handling 3 operands in an expression without raising an exception Neil Cerutti <neilc@norwich.edu> - 2013-09-30 12:56 +0000
Re: Handling 3 operands in an expression without raising an exception Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-09-28 19:45 +0100
Re: Handling 3 operands in an expression without raising an exception Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-28 19:20 +0000
Re: Handling 3 operands in an expression without raising an exception Chris Angelico <rosuav@gmail.com> - 2013-09-29 09:04 +1000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-29 10:35 +0300
Re: Handling 3 operands in an expression without raising an exception Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-09-29 12:35 +0300
Re: Handling 3 operands in an expression without raising an exception Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-29 09:48 +0000
Re: Handling 3 operands in an expression without raising an exception Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-09-29 14:04 +0300
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-29 14:14 +0300
Re: Handling 3 operands in an expression without raising an exception Dave Angel <davea@davea.name> - 2013-09-29 11:27 +0000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-29 14:34 +0300
Re: Handling 3 operands in an expression without raising an exception Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-29 21:15 +0000
Re: Handling 3 operands in an expression without raising an exception Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-09-30 16:07 +0100
Re: Handling 3 operands in an expression without raising an exception Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-09-29 15:24 +0300
Re: Handling 3 operands in an expression without raising an exception Dave Angel <davea@davea.name> - 2013-09-29 09:50 +0000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-29 13:17 +0300
Re: Handling 3 operands in an expression without raising an exception Dave Angel <davea@davea.name> - 2013-09-29 10:57 +0000
Re: Handling 3 operands in an expression without raising an exception Chris Angelico <rosuav@gmail.com> - 2013-09-29 23:58 +1000
Re: Handling 3 operands in an expression without raising an exception Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-29 21:01 +0000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-29 14:06 +0300
Re: Handling 3 operands in an expression without raising an exception Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-29 12:48 +0200
Re: Handling 3 operands in an expression without raising an exception Piet van Oostrum <piet@vanoostrum.org> - 2013-09-29 13:24 -0400
Re: Handling 3 operands in an expression without raising an exception MRAB <python@mrabarnett.plus.com> - 2013-09-29 18:44 +0100
Re: Handling 3 operands in an expression without raising an exception Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-29 14:45 -0400
Re: Handling 3 operands in an expression without raising an exception Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-09-30 16:05 +0100
Re: Handling 3 operands in an expression without raising an exception Ben Finney <ben+python@benfinney.id.au> - 2013-09-29 11:35 +1000
Re: Handling 3 operands in an expression without raising an exception Chris Angelico <rosuav@gmail.com> - 2013-09-28 11:59 +1000
Re: Handling 3 operands in an expression without raising an exception Νίκος <nikos.gr33k@gmail.com> - 2013-09-28 12:14 +0300
Re: Handling 3 operands in an expression without raising an exception Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-28 15:53 +0200
Re: Handling 3 operands in an expression without raising an exception Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-28 12:15 -0400
Re: Handling 3 operands in an expression without raising an exception Robert Kern <robert.kern@gmail.com> - 2013-09-28 12:18 +0100
Re: Handling 3 operands in an expression without raising an exception giacomo boffi <pecore@pascolo.net> - 2013-09-29 17:28 +0200
Re: Handling 3 operands in an expression without raising an exception Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-29 12:07 -0400
Re: Handling 3 operands in an expression without raising an exception giacomo boffi <pecore@pascolo.net> - 2013-09-29 23:39 +0200
Re: Handling 3 operands in an expression without raising an exception giacomo boffi <pecore@pascolo.net> - 2013-09-29 23:49 +0200
Re: Handling 3 operands in an expression without raising an exception Chris Angelico <rosuav@gmail.com> - 2013-09-30 02:18 +1000
Re: Handling 3 operands in an expression without raising an exception Dave Angel <davea@davea.name> - 2013-09-26 20:37 +0000
Re: Handling 3 operands in an expression without raising an exception Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-26 14:38 +0000
Re: Handling 3 operands in an expression without raising an exception Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-26 14:38 +0000
Re: Handling 3 operands in an expression without raising an exception Gene Heskett <gheskett@wdtv.com> - 2013-09-29 13:32 -0400
csiph-web