python & suds "ImportError: cannot import name getLogger" - python

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)

Related

Errors importing pyodbc

My background is Java/C++ and I'm very new to python. I'm trying to import pyodbc to my project which works alright if I do it via command line.
import odbc
However, when I try to do the same in pydev/eclipse, i get the following error which I cannot find a solution to. I suspect this may have something to do with Eclipse setup
Traceback (most recent call last):
File "C:\Users\a\workspace\TestPyProject\src\helloworld.py", line 2, in <module>
import pyodbc
File "C:\Users\a\AppData\Local\Continuum\Anaconda3\Lib\site-packages\sqlalchemy\dialects\mssql\pyodbc.py", line 105, in <module>
from .base import MSExecutionContext, MSDialect, VARBINARY
ImportError: attempted relative import with no known parent package
I'm really stuck here and any hints will be appreciated!
An incorrect library was imported into the External Libraries list of the project. After fixing it, the import is working.

Sublime text plugin development

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.

Go tutorial for Google App Engine: ImportError: No module named _md5

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!

Is the routes Dispatcher broken in CherryPy for Mac?

Is CherryPy broken? I just set it up and tried to use the routes dispatcher but it has an import error, my code is as follows:
import cherrypy
mapper = cherrypy.dispatch.RoutesDispatcher()
The error is:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jwesonga/environments/cherrypy/lib/python2.6/site-packages/CherryPy-3.2.2-py2.6.egg/cherrypy/_cpdispatch.py", line 463, in __init__
import routes
ImportError: No module named routes
I'm on a Mac and I tried both 3.2.2 and 3.0 using virtualenv for the latter.
I have successfully used CherryPy with the routes dispatcher under OS X.
The error you've shown is:
ImportError: No module named routes
This is pretty clear -- Python can't find the routes modules. Have you installed it? This is not part of CherryPy, it's a separate module that you will need to install. If you're using MacPorts, you should be able to:
port install py-routes
(Or py25-routes or py26-routes depending on which Python you're using). If you're using virtualenv, you can simply run:
easy_install routes

No module named _core when using mailer.py on Windows/Python 2.7

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.

Categories