[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-bugs] <bug>: starting for the first time

From: Karsten Hilbert
Subject: Re: [Gnumed-bugs] <bug>: starting for the first time
Date: Fri, 21 Oct 2011 12:51:55 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hello gzorzos,

thanks for your report.

This issue ...

> 2011-10-21 09:44:19  DEBUG     gm.gui 
> (c:\workplace\gnumed-client.0.9.9\build\pyi.win32\setup\outpyz1.pyz\gnumed.wxpython.gmexceptionhandlingwidgets::handle_uncaught_exception_wx()
>  #177): unhandled exception caught:
> Traceback (most recent call last):
>   File "<string>", line 527, in <module>
>   File 
> "C:\workplace\gnumed-client.0.9.9\build\pyi.win32\setup\outPYZ1.pyz/Gnumed.wxpython.gmGuiMain",
>  line 3350, in main
>   File 
> "C:\workplace\gnumed-client.0.9.9\build\pyi.win32\setup\outPYZ1.pyz/wx._core",
>  line 7978, in __init__
>   File 
> "C:\workplace\gnumed-client.0.9.9\build\pyi.win32\setup\outPYZ1.pyz/wx._core",
>  line 7552, in _BootstrapApp
>   File 
> "C:\workplace\gnumed-client.0.9.9\build\pyi.win32\setup\outPYZ1.pyz/Gnumed.wxpython.gmGuiMain",
>  line 2828, in OnInit
>   File 
> "C:\workplace\gnumed-client.0.9.9\build\pyi.win32\setup\outPYZ1.pyz/Gnumed.wxpython.gmGuiMain",
>  line 3014, in __establish_backend_connection
>   File 
> "C:\workplace\gnumed-client.0.9.9\build\pyi.win32\setup\outPYZ1.pyz/Gnumed.wxpython.gmAuthWidgets",
>  line 137, in connect_to_database
>   File 
> "C:\workplace\gnumed-client.0.9.9\build\pyi.win32\setup\outPYZ1.pyz/Gnumed.pycommon.gmPG2",
>  line 1360, in get_raw_connection
> UnicodeEncodeError: 'ascii' codec can't encode characters in position 65-67: 
> ordinal not in range(128)

... delves deeply into Python internals. The core of the
matter is documented here:

Why is this relevant to GNUmed ? This, again, is deeply
dependant on PostgreSQL behaviour.

PostgreSQL prides itself in sending localized error messages
even before client and server have had a chance to agree on
an encoding to use between themselves. This problem has been
taken up with PostgreSQL folks but so far has garnered
little attention. What happens is that psycopg2 (Python)
receives an error messages from libpq (PostgreSQL) - which
can be in any encoding w/o a chance to know beforehand -- in
your case it is some form of Greek encoding. Now, Python
tries to bring this exception to the attention of the user.
It tries to turn the exception into printable (displayable)
form. That conversion fails with the error you are seeing if
the message contains non-ascii characters (such as Greek).

You've got several options:

- tell PostgreSQL to report messages in English (GNUmed
  tries but cannot catch some cases)

> 2011-10-21 09:44:10  INFO      gm.launcher (<string>::log_startup_info() 
> #204): Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit 
> (Intel)] on win32 (nt)

- use a Python > 2.5 which according to 

  offers a fix

- set up PostgreSQL/GNUmed such that no error
  occurs in the first place, this can be any of

        - bootstrap the GNUmed database
        - use proper credentials
        - allow local database access
        - ...

  which is what PostgreSQL/GNUmed helpfully try
  to tell you here but which Python fails to

GPG key ID E4071346 @
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

reply via email to

[Prev in Thread] Current Thread [Next in Thread]