dqjmq28248 2018-09-04 00:30
浏览 95
已采纳

PHP shell_exec与python naoqi:“qimessaging.socketcache:过滤后没有更多端点可用”

I can't seem to get my python script to work when I execute it in PHP with shell_exec

I am using the virtual robot in choregraphe

Here is my code: PHP

$command = escapeshellcmd("python test.py");
$output = shell_exec ($command);
echo $output;

Python:

from naoqi import ALProxy
import os,sys
import motion

#import qi.logging
#qi.logging.setLevel(qi.logging.FATAL)

pFractionMaxSpeed=0.4
mp = ALProxy("ALMotion", "127.0.0.1",51712)
JointName = JointNames = ["LShoulderRoll","LShoulderPitch","LElbowYaw","LElbowRoll","LHand"]
Arm1 = [90,0,-90,-85,90]
Arm1 = [ x * motion.TO_RAD for x in Arm1]
mp.post.angleInterpolationWithSpeed(JointNames, Arm1, pFractionMaxSpeed)

If I just run the python through cmd, then it works fine and makes the robot move.

I think it has something to do with that it is run as the www-data user and it messes the naoqi modules up (or something along those lines): link

I am just not sure how to do it in windows with XAMPP or WAMP

  • 写回答

1条回答 默认 最新

  • doushi1974 2018-09-04 15:12
    关注

    It may be that your www-data user does not have access to port 51712 (or whichever port Choregraphe's virtual nao is using - it may change between sessions, have you checked that?). Maybe you can try running telnet 127.0.0.1 51712 from your PHP code - if that doesn't work, qimessaging won't be able to connect to that port either.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?