ImportError:没有名为temboo.core.session的模块

时间:2016-01-03 08:18:03

标签: python arduino dropbox arduino-yun temboo

我正在使用python文件在arduino yun上运行。 但它给了我这个错误:

  

Traceback(最近一次调用最后一次):文件   “/mnt/sda1/upload_picture.py”,第7行,在模块

from temboo.core.session import TembooSession
     

ImportError:没有名为temboo.core.session的模块

代码

# coding=utf-8
# Script to upload files to Dropbox

# Import correct libraries
import base64
import sys
from temboo.core.session import TembooSession
from temboo.Library.Dropbox.FilesAndMetadata import UploadFile

print str(sys.argv[1])

# Encode image
with open(str(sys.argv[1]), "rb") as image_file:
    encoded_string = base64.b64encode(image_file.read())

# Declare Temboo session and Choreo to upload files
session = TembooSession('yourSession', 'yourApp', 'yourKey')
uploadFileChoreo = UploadFile(session)

# Get an InputSet object for the choreo
uploadFileInputs = uploadFileChoreo.new_input_set()

# Set inputs
uploadFileInputs.set_AppSecret("yourAppSecret")
uploadFileInputs.set_AccessToken("yourAccessToken")
uploadFileInputs.set_FileName(str(sys.argv[1]))
uploadFileInputs.set_AccessTokenSecret("yourTokenSecret")
uploadFileInputs.set_AppKey("yourAppKey")
uploadFileInputs.set_FileContents(encoded_string)
uploadFileInputs.set_Root("sandbox")

# Execute choreo
uploadFileResults = uploadFileChoreo.execute_with_results(uploadFileInputs)

1 个答案:

答案 0 :(得分:0)

temboo SDK应该位于系统路径中的某个位置。要找出不同的位置,请输入以下内容:

i

移动SDK后,请确保是否有文件" ____ init ___。py"在每个适当的文件夹(temboo,Library,core等)中:

root@Arduino:/arduino# python
Python 2.7.3 (default, Apr 11 2014, 04:38:09) 
[GCC 4.6.3 20120201 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', '/usr/lib/python27.zip', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-      linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/lib/python2.7/site-packages']