I have developed a command line python application to save a source file with syntax highlight (pygments) as a evernote note; well this work fine.
Now i would like to integrate this application in a sublime text 2 plugin, but my application needs some python modules to work (like evernote sdk, pygments library).
Project's structure is following:
Package
|
---My_Plugin
|
-----evernote/
|
-----pygments/
|
myplugin_main.py
I'm tring to include modules as following:
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
I'm having a lot of problems to work this external modules; i don't understand why it seems that the application don't see modules.
From the sublime console, when i try to save i receive something like this:
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'
of course I tried to add also oauth2 and httplib2 like i say above, but nothing.
How can i do to solve this problem?
As for the error you got, could it be similar issue to this?
HTTPSConnection module missing in Python 2.6 on CentOS 5.2
For the sublime 2 plugin, this is what I found on github: https://github.com/jamiesun/SublimeEvernote
and I forked it and updated as non OAuth version with Evernote SDK: https://github.com/rekotan/SublimeEvernote
Those above might help you to build your own.
Related
I am trying to use google endpoint v2
following this tutorial
I have done all steps up until the To generate the required configuration file: Step
But when i try the following command
python lib/endpoints/endpointscfg.py get_swagger_spec main.EchoApi --hostname echo-api.endpoints.xxxxxxx.appspot.com
I get the following warning and error
WARNING: Could not find the fix_sys_path() function in dev_appserver.
If you encounter errors, please make sure that your Google App Engine
SDK is up-to-date. Traceback (most recent call last):
File "lib/endpoints/endpointscfg.py", line 59, in
import _endpointscfg_setup # pylint: disable=unused-import
File "D:\Libraries\Documents\transporter\lib\endpoints_endpointscfg_setup.py",
line 107, in
`
_SetupPaths()
File "D:\Libraries\Documents\transporter\lib\endpoints_endpointscfg_setup.py",
line 103, in _SetupPaths
from google.appengine.ext import vendor ImportError: No module named google.appengine.ext
And no OpenAPI configuration file is generated
I have reinstalled everything,updated everything , checked system variables but still getting the error
p.s on windows 7
#HondaGuy's Comment was the answer I added app-engine to my python path,
my python environment variable now looks like this
C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\Program
Files (x86)\Google\Cloud
SDK\google-cloud-sdk\platform\bundledpython;C:\Program Files
(x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine;
My helloworld code doesnt run on google app engine...
I use python 2.7.6 and google app engine version 1.8.8.
Here is what I get:
Traceback (most recent call last):
File "/home/yash/Google/google_appengine/old_dev_appserver.py", line 196, in <module>
run_file(__file__, globals())
File "/home/yash/Google/google_appengine/old_dev_appserver.py", line 192, in run_file
execfile(script_path, globals_)
File "/home/yash/Google/google_appengine/google/appengine/tools/dev_appserver_main.py", line 173, in <module>
from google.appengine.tools import appcfg
File "/home/yash/Google/google_appengine/google/appengine/tools/appcfg.py", line 74, in <module>
from google.appengine.tools import appengine_rpc
File "/home/yash/Google/google_appengine/google/appengine/tools/appengine_rpc.py", line 28, in <module>
import fancy_urllib
File "/home/yash/Google/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py", line 354, in <module>
class FancyHTTPSHandler(urllib2.HTTPSHandler):
AttributeError: 'module' object has no attribute 'HTTPSHandler'</i>
well...problem solved...i guess few libraries werent installed...compiled python 5-6 times after each library installation...
the problem wasnt in the GAE...it was the lack of required python modules
m still a noob...
Thanks for your time and help :)
Looks like you don't have python support for SSL.
Try this
pip install ssl
Read python-ssl docs for details.
From the docs
If you want to use native python ssl, you must enable it using the
libraries configuration in your application's app.yaml file where you
specify the library name "ssl", as shown here:
libraries:
- name: ssl
version: latest
Does your app.yaml contain this?
Your google appengine environment probably isn't installed properly. I'd recommend reinstalling the SDK and checking for errors in the installation.
If you're using something like virtualenv, it could be affecting the way your install works.
I'm trying to run the hello world tutorial for the Google app engine in Go language. The GAE SDK for go is based on python 2.5, which I installed. I then had to install openssl, but now when I try to run my sample application on the SDK, I get the following error:
ImportError: No module named _md5
I even tried a simple import md5 & import hashlib from the python interpreter interface, and i still get the same error
>>> import hashlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.5/hashlib.py", line 133, in <module>
md5 = __get_builtin_constructor('md5')
File "/usr/local/lib/python2.5/hashlib.py", line 60, in __get_builtin_constructor
import _md5
ImportError: No module named _md5
Does anybody know a workaround for this? Thank you!
I have a feeling that this problem is really about python installation than anything else
Your problem has nothing to do with GAE, or the SDK. I have faced this before. If you tried to install your custom version of python (on Ubuntu), then you land up with such issues. You should uninstall the custom python using checkinstall. More details can be found about there here: Uninstall python built from source?.
Just use the default python and you'll be fine!
I'm trying to configure and run SVN post-commit hook sending mails. I've downloaded class mailer.py, installed Python 2.7 and svn-win32 bindings for svn. The machine is Windows-7 64 bit, the Python is 32 bit. Now the mailer.py ends with error, which is caused by import problem.
When I in python console type "import svn.core" I have following error:
>>> import svn.core
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\tools\Python27\lib\site-packages\svn\core.py", line 19, in <module>
from libsvn.core import *
File "c:\tools\Python27\lib\site-packages\libsvn\core.py", line 5, in <module>
import _core
ImportError: No module named _core
while in directory site-packages/libsvn are files such as: _core.dll
I've installed other bindings, pysvn, that was installed correctly, but as far as I've noticed, it's the totally other API so I can't use that for python.py
Does someone had similar problem and knows how to deal with it?
The Python bindings need to load the native Subversion libraries (DLL's). If your Python is 32-bit then you would need 32-bit versions of the native Subversion libraries on PATH.
I have problem like this. Trouble was that python just can not import this library (svn.core and other).
I just make:
import sys
sys.path.append("C:\csvn\lib\svn-python").
My file core.pyc was in C:\csvn\lib\svn-python\svn. Hope it helps somebody. Such behacior for me is strange because there is no "init.py" or "init.pyc" file in svn-python directory. But it works.
I'm using Ubuntu 11.04 (natty). I have been using Suds to consume a SOAP web service. Everything was working fine... until it wasn't. I can no longer import Suds. I've uninstalled and re-installed Suds from the Ubuntu repositories but still get the same import error (see IDLE traceback below). I'm using Python 2.7.1 and Suds 0.4.1-2. Does anyone have any ideas on how to solve this problem??
>>> import suds
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import suds
File "/usr/lib/pymodules/python2.7/suds/__init__.py", line 154, in <module>
import client
File "/usr/lib/pymodules/python2.7/suds/client.py", line 23, in <module>
import suds.metrics as metrics
File "/usr/lib/pymodules/python2.7/suds/metrics.py", line 23, in <module>
from logging import getLogger
ImportError: cannot import name getLogger
>>>
logging is a standard module of Python. There are several possible reasons why Python can't find it anymore:
The is another logging module in the path (print sys.path to get a list of paths Python will search)
Someone changed PYTHONPATH (the default Python search path)
Someone messed with the Python installation (deleted the logging module)