我开发了一个命令行 python 应用程序来保存带有语法高亮(pygments)的源文件作为印象笔记;好吧,这很好。现在我想将此应用程序集成到一个 sublime text 2 插件中,但我的应用程序需要一些 python 模块才能工作(如 evernote sdk、pygments 库)。项目结构如下:
Package
|
---My_Plugin
|
-----evernote/
|
-----pygments/
|
myplugin_main.py
我试图包括以下模块:
import sys, os
sys.path.append(os.path.abspath(os.path.dirname(__file__))+"/evernote")
sys.path.append(os.path.abspath(os.path.dirname(__file__))+"/pygments")
from evernote.api.client import EvernoteClient
import evernote.edam.type.ttypes as Types
import evernote.edam.notestore.NoteStore as NoteStore
import evernote.edam.userstore.UserStore as UserStore
我在处理这个外部模块时遇到了很多问题;我不明白为什么应用程序似乎看不到模块。
从 sublime 控制台,当我尝试保存时,我收到如下信息:
Reloading plugin /home/sergioska/.config/sublime-text-2/Packages/evernote-sublime-plugin/ever.py
Traceback (most recent call last):
File "./sublime_plugin.py", line 62, in reload_plugin
File "./ever.py", line 3, in <module>
from evercode import EverCode
File "./evercode.py", line 7, in <module>
from evernote.api.client import EvernoteClient
File "/home/sergioska/.config/sublime-text-2/Packages/evernote-sublime-plugin/evernote/evernote/api/client.py", line 5, in <module>
import oauth2 as oauth
File "./oauth2/__init__.py", line 32, in <module>
import httplib2
File "./httplib2/__init__.py", line 915, in <module>
class HTTPSConnectionWithTimeout(httplib.HTTPSConnection):
AttributeError: 'module' object has no attribute 'HTTPSConnection'
当然,我也尝试像上面所说的那样添加 oauth2 和 httplib2,但什么也没有。我该怎么做才能解决这个问题?