Python SDK tips and tricks

See also

Overview | C++ | Python | .Net | Java | Matlab | Urbi

Python SDK | Python SDK Install Guide | Python tutorials | Python Examples | Python SDK tips and tricks


Troubleshooting

Here are a few error message you could get, and a possible solution.

Import error

ImportError: No module named naoqi

You must have something wrong with your PYTHONPATH environnement variable. You can check this by typing:

import sys
print "\n".join(sys.path)

You should see /path/to/python-sdk at the beginning of the list.

ImportError: ./_inaoqi.so: wrong ELF class: ELFCLASS32

You are using a 64 bits version of python.

ImportError: libpython2.6.so.1.0: cannot open shared object file: No such file or directory

You are using a Python2.7 with the python2.6 version of the Python SDK.

Version mismatch

Version mismatch

Your version of Python does not match the one with which the Python SDK was made.

Mac

Make sure VERSIONER_PYTHON_PREFER_32_BITS is not set. (While 1.10 needed this parameter ON, release 1.12 needs this parameter to be OFF)

Errors with ALProxy

RuntimeError:         ALBrokerProxy::getBrokerInfo
    can not get broker info. Endpoint : http://nao.local:9559

Make sure NAOqi is running and the IP you used in ALProxy constructor is correct

RuntimeError:         ALNetwork::getModuleByName
    failed to get module MyModule http://nao.local:9559

Make sure you spelt the name of the module correctly.

File "naoqi.py", line 246, in method_missing
    raise e
RuntimeError:         ALTextToSpeech::sa
        ALBroker::methodCall: method: sa, params: ["hello"]
        ALTextToSpeech::sa
Function sa does not exist in module ALTextToSpeech

Make sure you spelt the name of the function correctly.

To check the complete list of modules and method names, see section NAOqi modules APIs

Weird float errors

If you notice that floats are trucated when they are the result of the call of a bound methods, make sure that your locale is in english.

You can set LC_NUMERIC=’C’ for this

import locale
locale.setlocale(locale.LC_NUMERIC, 'C')