Re: What GVariant corresponds to a Python3 int?



Am 13.07.2012 07:07, schrieb Robert Park:
> So, I'm just beginning the process of porting my PyGObject application
> to Python3. Mostly it's going well (it runs and most features
> function), but I'm getting this weird error message:
> 
> (gottengeography:9763): GLib-GIO-CRITICAL **: g_settings_bind:
> property 'offset' on class 'gg+camera+Camera' has type 'glong' which
> is not compatible with type 'i' of key 'offset' on schema
> 'ca.exolucere.gottengeography.camera'
> 
> And here is the related code, which worked perfectly in Python 2.7:
> 
> class Camera(GObject.GObject):
>     offset = GObject.property(type=int, minimum=-3600, maximum=3600)
>     utc_offset = GObject.property(type=int, minimum=-24, maximum=24)
>     [...etc...]
> 
> So, why are Python3 ints translating into glongs, how is that different
> from the behavior in Python 2.7, and what should I do to fix this? For
> the purposes of the property I need the number to be an integer. I
> tried most other gvariant types in the schemas but nothing seemed
> to suppress this error.
> 
> Thanks.
> 
Hi Robert,

note that Python3's int is essentially Python2's int [1], i.e. Python3
does not have separate types for int and long, both are int.

This could still be a problem in pygobject as well, not sure, yet.

[1]: http://docs.python.org/py3k/whatsnew/3.0.html#integers

-- 
Sebastian

Attachment: signature.asc
Description: OpenPGP digital signature



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