On Thursday, April 28, 2016 at 1:11:03 AM UTC+3, Steven G. Johnson wrote:
>
> ERROR: LoadError: PyError (:PyObject_Call) <type 
>> 'exceptions.AttributeError'>
>> AttributeError("'PyCall.jl_Function' object has no attribute 'func_code'"
>> ,)
>>
>>
> The foo.func_code attribute of a Python function foo returns a code object 
> <http://akaptur.com/blog/2013/11/15/introduction-to-the-python-interpreter-2/>
>  representing 
> the compiled Python bytecode for foo.   A Julia function is not going to 
> have this attribute, because it has no Python bytecode.
>

OK, I see, thanks. I found this from the module source (client.py):
 
            if sys.version_info[0] < 3:
                argcount = self.on_connect.func_code.co_argcount
            else:
                argcount = self.on_connect.__code__.co_argcount


I thought this is the limitation and installed Python3, unfortunately then 
I got an error that __code__ is missing:

ERROR: LoadError: PyError (:PyObject_Call) <class 'AttributeError'>
AttributeError("'PyCall.jl_Function' object has no attribute '__code__'",)

Well, func_code seems to be __code__ in v3, so still the same problem... 
Maybe I have to contact the authors, anyone have another idea how to use 
MQTT from Julia (of course mosquitto_pub and _sub should work)?

Thanks,
Kaj


> It's really surprising to me that the paho.mqtt.client module only works 
> for callbacks with func_code attributes, which means that it only works for 
> pure Python functions.   Maybe you can inquire with the Paho authors to 
> find out why (and whether they can lift this limitation in a future 
> version).
>

Reply via email to