Installing a module on Choregraphe

2019-08-11 08:23发布

I am trying to install a python module to use in Choregraphe. For windows this does not appear to be an issue. All I have to do is make sure that the module is installed in Python on the operating system.

For OSX, it does not appear to recognise the module. I have also tried importing it as a folder to a project, but it still can't see it.

2条回答
来,给爷笑一个
2楼-- · 2019-08-11 09:07

From the linked site:

1. Download python scripts of Requests and its dependencies from github.

2. Copy these scripts into my Project content(I made 'lib' directory in the project and copied all scripts into the folder)

3. Add the following code to import the modules

import sys, os
framemanager = ALProxy("ALFrameManager")
folderName = os.path.join(framemanager.getBehaviorPath(self.behaviorId), "../lib")
if folderName not in sys.path:
    sys.path.append(folderName)
import requests

4. Add the following to unload the modules

import sys
if self.folderName and folderName in sys.path:
    sys.path.remove(folderName)
查看更多
祖国的老花朵
3楼-- · 2019-08-11 09:17

Do you try playing with the python system path: the location when he looks for library.

Like that (in your choregraphe box):

import sys
sys.path.append("path containing your_module folder")
import your_module
查看更多
登录 后发表回答