Hi Eric,

Proper support for passing unicode strings to Mapnik's python bindings is desirable, but at this point is waiting on support in Boost which is what we write the bindings in.

So, good question, but at least for now keep on calling str()...

The ticket is here: http://trac.mapnik.org/ticket/163

Dane


On Jan 14, 2010, at 3:32 PM, Eric France wrote:

Hello, I'm new to Mapnik-Users, and I have what might be a naive question about the Python bindings layer.

Intermittently I get an error of the type:

Python argument types in
    Color.__init__(Color, unicode)
did not match C++ signature:
    __init__(_object*, std::string)
    __init__(_object*, int, int, int)
    __init__(_object*, int, int, int, int)
Request Method: GET
Request URL:    
Exception Type: ArgumentError
Exception Value:        
Python argument types in
    Color.__init__(Color, unicode)
did not match C++ signature:
    __init__(_object*, std::string)
    __init__(_object*, int, int, int)
    __init__(_object*, int, int, int, int)

These occur when I pass a Python string that contains Unicode into the Python-Mapnik bindings, as:

colordef = u'#FFFF00'
color = mapnik.Color(colordef)

I've been able to work around this on a case-by-case basis by wrapping the Unicode strings in the string converter function:

colordef = u'#FFFF00'
color = mapnik.Color(str(colordef))

My question is, why isn't this conversion handled in the Python bindings layer automatically?

Eric France
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to