On Tue, 2005-03-01 at 06:50 -0500, Thomas Mills Hinkle wrote:
>I have a user reporting the following error with my newest gnomeprint
>implentation:
>gnomeprint.pango_create_context(gnomeprint.pango_get_default_font_map())
>AttributeError: 'module' object has no attribute
>'pango_create_context'
>
>I assume this error is a result of his using an older version of
>gnomeprint that doesn't support pango_create_context.  If so, I'd like
>to implement a workaround for users like him (I'll have my app detect
>the version and then give them my old not-pango-ified gnomeprint stuff
>if they can't support the new).  However, I wanted to confirm, if
>possible, that this is in fact a versioning issue.  So, can anyone
>tell me:
>
>1. When was pango_create_context added to gnomeprint?

  Since gnome-python 2.6.0, _but_ inclusion of this API is conditional,
depending on the availability of libgnomeprint-2.2 >= 2.7.2 installed on
the system.  So, I would say that this API is available in distributions
including gnome-python 2.6.x and GNOME platform 2.8.

>2. How would you suggest detecting the version of gnomeprint a user
>has installed?

  Try using this expression to see if the API is there:
hasattr(gnomeprint, "pango_create_context")


  Alternatively, you can:
try:
   #... use new pango API
except AttributeError:
   #... use old API


  Regards.

-- 
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
The universe is always one step beyond logic.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to