在Python中的调用中传递一个变量以对分arduino操作

在Python中的调用中传递一个变量以对分arduino操作,python,python-2.7,twitter,tweepy,arduino-yun,Python,Python 2.7,Twitter,Tweepy,Arduino Yun,Python的编写完全没有问题,所以请耐心点。 我已经试了几个小时来解决这个问题,但这么长时间我都无法解决。 我在Python中所做的唯一工作要简单得多,并且不涉及库 我正在使用Python代码在我的Yún上实现Arduino操作。它基于Tweepy库。 我的主要目标是插入三个标签,在Arduino中做三件不同的事情,这取决于哪个标签被推特。 所以,一切都很好,只要有任何标签被推特,我的LED就会闪烁。 我现在要做的是在Arduino上运行对分代码 这是我的streaming.py代码的一部分:

Python的编写完全没有问题,所以请耐心点。 我已经试了几个小时来解决这个问题,但这么长时间我都无法解决。 我在Python中所做的唯一工作要简单得多,并且不涉及库

我正在使用Python代码在我的Yún上实现Arduino操作。它基于Tweepy库。 我的主要目标是插入三个标签,在Arduino中做三件不同的事情,这取决于哪个标签被推特。 所以,一切都很好,只要有任何标签被推特,我的LED就会闪烁。 我现在要做的是在Arduino上运行对分代码

这是我的streaming.py代码的一部分:

search_string = '#jekotest'

class StdOutListener(StreamListener):

"""
A listener handles tweets are the received from the stream.
This is a basic listener that just prints received tweets to stdout.
"""

def on_data(self, data):
    # I call an external script because the Arduino's Bridge library
    # confilcts with the tweepy library
    call(["/usr/bin/python", script_path + "/go.py"])
    return True

def on_error(self, status):
    # TODO: Put some error handling here
    return False

if __name__ == '__main__':
    l = StdOutListener()
    auth = OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_token, access_token_secret)

    stream = Stream(auth, l)
    stream.filter(track=[search_string])
这是go.py:

import sys
sys.path.insert(0, '/usr/lib/python2.7/bridge/')

from bridgeclient import BridgeClient as bridgeclient

value = bridgeclient()
value.put('go','1')
我知道stream.body是一个包含{'track':'#jekotest'}的dict,所以: 我他妈的怎么能做一件好事呢

if '#jekotest' in stream.body:
value.put('go', 1)
elif: 
'#anotherhashtag' in stream.body
value.put('go', 2)
等等


非常感谢

最后,我设法将这两个文件放在一起,使其工作如下:

hashtag = status.entities['hashtags']
    for value in hashtag:
        if translateHashtag1 in value['text']:
            goBridge.put('go', 1)

好的,第一点完成了。我在电话里传递一个论点。现在我需要知道哪个hashtag正在启动调用,以便采用不同的路径。仍然在努力,任何关于tweepy的想法都会很感激。这不是我想要的解决方案,但它是一个解决方案(特别是对于像我这样的普通人):只需通过调用go.py文件传递一个参数:
call([“/usr/bin/python”,script\u path+“/go.py,myArgument”])