----- Original Message -----
> ----- Original Message -----
> > [...]
> > I got rid of the utf-8 encoding, and I get the following error (using
> > "count" as the unit):
> >
> > PM_ERR_CONV Impossible value or scale conversion count
> >
> > So, there must be a bug still lurking there.
> >
>
> Hmmm. Below the API the code looks like this:
>
> @staticmethod
> def pmParseUnitsStr(string):
> if type(string) != type('') and type(string) != type(b''):
> raise pmErr(c_api.PM_ERR_CONV, str(string))
> if type(string) != type(b''):
> string = string.encode('utf-8')
>
> I'm not sure what you meant by 'using the "count" as unit' above - what's
> the type of "count"? I guess its failing that check on the first line,
> which is expecting either unicode or string of bytes.
Tick, tick, tick ... neurons finally fire ... oh, I think I see what you meant
now - "count", as in the literal string "count", not a variable, heh. However
I'm still getting good results with that here:
$ python
Python 2.7.5 (default, Nov 3 2014, 14:26:24)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pcp import pmapi
>>> import cpmapi as c_api
>>> context = pmapi.pmContext()
>>> context.pmParseUnitsStr("count")
(<pcp.pmapi.pmUnits object at 0x7ff718e7c710>, 1.0)
>>> ^D
$ python3
Python 3.3.2 (default, Dec 4 2014, 12:49:00)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pcp import pmapi
>>> import cpmapi as c_api
>>> context = pmapi.pmContext()
>>> context.pmParseUnitsStr("count")
(<pcp.pmapi.pmUnits object at 0x7f9e3952fb00>, 1.0)
>>> ^D
I guess one of those fails with an exception for you locally?
cheers.
--
Nathan
|