2018-09-04 00:30
浏览 77

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;


from naoqi import ALProxy
import os,sys
import motion

#import qi.logging

mp = ALProxy("ALMotion", "",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

图片转代码服务由CSDN问答提供 功能建议



这是我的代码: PHP

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

Python: \ 来自naoqi的n 导入ALProxy import os,sys import motion #import qi.logging #qi.logging.setLevel(qi.logging.FATAL) pFractionMaxSpeed = 0.4 mp = ALProxy(“ALMotion”,“”,51712) JointName = JointNames = [“LShoulderRoll”,“LShoulderPitch”,“LElbowYaw”,“LElbowRoll”,“LHand”] Arm1 = [90, 0,-90,-85,90] Arm1 = [x *在Arm1中为x的motion.TO_RAD] mp.post.angleInterpolationWithSpeed(JointNames,Arm1,pFractionMaxSpeed) \ n


我认为它与它运行时有关 数据用户和它 弄乱了naoqi模块(或类似的东西):链接


  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

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 51712 from your PHP code - if that doesn't work, qimessaging won't be able to connect to that port either.

    打赏 评论

相关推荐 更多相似问题