Re: Problem with pl/python procedure connecting to the internet

Поиск
Список
Период
Сортировка
От Charles Clavadetscher
Тема Re: Problem with pl/python procedure connecting to the internet
Дата
Msg-id 018201d0dd6d$ca8a2810$5f9e7830$@swisspug.org
обсуждение исходный текст
Ответ на Re: Problem with pl/python procedure connecting to the internet  (Igor Sosa Mayor <joseleopoldo1792@gmail.com>)
Список pgsql-general
> -----Original Message-----
> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
> owner@postgresql.org] On Behalf Of Igor Sosa Mayor
> Sent: Sonntag, 23. August 2015 07:22
> To: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] Problem with pl/python procedure connecting to the
> internet
>
> Adrian Klaver <adrian.klaver@aklaver.com> writes:
>
> > Are you taking lack of coordinates in the table as evidence of no
> > connection or are you determining that some other way?
>
> thanks again for your answer. The evidence is very easy. I get this[1].
> BUT: if I try exactly the same python code in a console there is no error
and
> the coordinates are there.
>
> > Have you tried using plpy.notice in plpythonu and RAISE NOTICE in
> > plpgsql to track what is happening?
>
> Yes, if the connection works, I get the correct answer. As I say: for some
> reason postges can not make the connection OR get the answer (but not
> always, it has worked only 3-4 times). All other things are working:
> internet connection, python code...
>
>
> [1]
> ERROR:  geopy.exc.GeocoderServiceError: <urlopen error [Errno -2] Nombre
> o servicio desconocido>
> CONTEXTO:  Traceback (most recent call last):
>   PL/Python function "geocodificar", line 4, in <module>
>     location = geoloc.geocode(direccion)
>   PL/Python function "geocodificar", line 190, in geocode
>   PL/Python function "geocodificar", line 159, in _call_geocoder función
> PL/Python «geocodificar»
> sentencia SQL: «SELECT *             from geocodificar(NEW.ciudad || ' '
||
> NEW.pais)»
> función PL/pgSQL anadirgeocoord() en la línea 5 en sentencia SQL

Are you sure that you really use exactly the same code? The indication
"survice unknown" seems to point to an error in the URL and not to an
authorization problem. Maybe some encoding problem?
The irritating thing is that you mention that it works sometimes and
sometimes not. Getting back to the encoding problem idea, is there a
difference if you call the function with a name containing special
characters (e.g. "é", "à", "ñ") or not?

Regards
Charles





В списке pgsql-general по дате отправления:

Предыдущее
От: Igor Sosa Mayor
Дата:
Сообщение: Re: Problem with pl/python procedure connecting to the internet
Следующее
От: Igor Sosa Mayor
Дата:
Сообщение: Re: Problem with pl/python procedure connecting to the internet