I am using OpenSuse Tumbleweed and try to connect my pythons script with an ldap server.
following my code:
import ldap
connection = ldap.initialize("*address*")
But i got following error:
File "ldap.py", line 1, in <module>
import ldap
File "*path*/ldap.py", line 3, in <module>
connection = ldap.initialize("*address*")
AttributeError: 'module' object has no attribute 'initialize'
I looked up the python-ldap documentation, but the "initialize" functio should exist :/
When i try to install python-ldap, the console told me, that this is already installed.
Can somebody help me?
best regards
I found my mistake:
The file was named ldap.py an was the only file in this directory. But know, python tried to import this file into the same file.
I renamed it to test_ldap.py and know everything works fine
Best Regards
Related
When I make Python code, I keep getting errors.
(No module named 'sklearn' and Failed to open file
b'C:\\Users\\\xea\xb9\x80\xec\x8a\xb9\xec\xb2\xa0\\AppData\\Local\\Temp\\scipy-zgoub8mi'
File "C:\python\Bode_plot.py", line 2, in <module>
from scipy import signal
-->The two errors are different codes)
Can I get some help?
I've already tried all the ways on the GOOGLE :(
PLEASE HELP ME..
module error:
os error:
I am using imaplib to read some emails. This code works without error within Pycharm. I have used cx_Freeze to make this program an executable, and now I get an error that traces back to cx_Freeze's startup.py. I have made an executable before, not with imaplib, and this kind of problem didn't happen.
There are other posts online about a "module imaplib has no attribute IMAP4_SSL", but these do not solve the problem and may have different causes than mine. Other causes for that statement involve virtual environments or things different than my situation.
The full error message is below:
Traceback (most recent call last):
File "C:\Users\Todd\Desktop\Python\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run module.run()
File "C:\Users\Todd\Desktop\Python\lib\site-packages\cx_Freeze\initscrips\Console.py", line 26, in run exec(code, m.__dict__)
File "Main.py", line 18, in <module>
File 'C:Users\Todd\Desktop\ForStemotics\EmailGetter.py", line 43, in GetEmails
mail = imaplib.IMAP4_SSL("imap.gmail.com")
AttributeError: module 'imaplib' has no attribute 'IMAP4_SSL'
EDIT in setup.py from comments:
from cx_Freeze import setup, Executable
setup(name = 'SARS',
version='0.1',
description = 'email automator',
executables = [Executable("Main.py")])
Thank you to all who contributed and viewed. I have solved the problem. After some experimenting I traced the problem to the ssl module. I couldn't find a way around this but I found another fix. I upgraded from python 3.7.1 to the latest version 3.7.3 and the problem stopped. I don't know why this is, but if anyone else was experiencing mine or a similar problem I would recommend this as something to try.
I'm trying to connect my OpenERP 7.0 to my Magento webSite 1.9.
I'm using the connector developed by openLabs https://github.com/openlabs/magento_integration
I follow the instructions of https://openerp-magento-connector.readthedocs.io/en/develop/introduction.html#installation
But after 3 restores of my OpenERP, I still have an error when I tried to update my modules to get my Magento module.
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/addons/base/module/module.py", line 617, in update_list
handler.load_addons()
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/addons/web/http.py", line 580, in load_addons
m = import('openerp.addons.' + module)
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/modules/module.py", line 133, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/addons/magento_integration-develop/init.py", line 9, in
import magento_
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/addons/magento_integration-develop/magento_.py", line 17, in
import magento
ImportError: No module named magento
I'm thinking this module isn't stable but when I read on forums, I saw people saying it works.
Some of this people or someone else can explain to me how they did ? Or another solution ? I'm open to multiple ways as it works. (But I haven't the possibility to upgrade my OpenERP in 8.0 or 9.0).
Thanks
EDIT : To #CZoellner
First, thx for your helpful answers
Ok, I solve the problem, my python lib was installed but my openERP installer didn't find it. So I modify the script to add the way of my module in sys.path. This error is resolved.
But now, I have another error seems the first
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/addons/magento_integration-develop/init.py", line 10, in
import country
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/addons/magento_integration-develop/country.py", line 18, in
import pycountry
ImportError: No module named pycountry
and the sys.path has already the good way
[...
'/usr/local/lib/python2.7/dist-packages/pycountry-1.20-py2.7.egg',
...]
I never develop in python so I certainly missed something
Ok, So I again restoring my snapshot ...
But now, instead using the installer, I downloaded the library manually and install it one by one.
So I install, pycountry lib and magento lib. I update the file "magento_.py" and "pycountry.py" of openLab connector to add the path of my library on sys.path.
Something like that
import sys
sys.path.append("/usr/local/lib/python2.7/dist-packages/pycountry-1.20-py2.7.egg/")
I run the setup of openLabs connector and after I launch update of openERP.
And it finally works ! whew !
Anyway thx for your useful answers !
I'm fairly new to python and I'm trying to get Pybluez to work for me.
Here is what happens when i try to discover bluetooth devises.
import bluetooth
nearby_devices = bluetooth.discover_devices()
Traceback (most recent call last):
File "<stdin>",line1,in <module>
AttributeError: 'module' object has no attribute 'discover_devices'
I'm on windows 8.1, python 2.7.10, pybluez 0.21
I had the same problem, I did the mistake of naming my program file bluetooth.py , which confused python for the package resolution, you should look out for this silly mistake if this is the case .
If this is not the case then try to put your file in the directory where your bluetooth directory (in my case, C:\Python27\Lib\site-packages) is located and then run it from there, it worked for me.
I faced same issue because i have taken my file name bluetooth.py.For that reason python unable to understand which file be execute.
Please rename your file then it will be work.
rename the file to any other nameļ¼ except "bluetooth.py"
My script was running well before. I had a series of crashes on some scripts where I had to fix some things. However, all of a sudden, I can't even run a script and my sublime text shell is displaying this error. I tried chasing down the files in my /Library/...python... files to see if any files got renamed or any part of the module scripts got renamed or something, but have yet to figure it out. What can I try. Or better question, what did I do all of a sudden to cause this, and how would I undo it? It was literally working fine less than an hour ago not to mention all day.
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/numerictypes.py", line 101, in <module>
import numbers
File "/Users/peter/Documents/Trading/Code/AlphaModelVer1/numbers.py", line 2, in <module>
import Quandl
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Quandl/__init__.py", line 11, in <module>
from .Quandl import (
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Quandl/Quandl.py", line 11, in <module>
import pandas as pd
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/__init__.py", line 7, in <module>
from . import hashtable, tslib, lib
File "pandas/src/numpy.pxd", line 157, in init pandas.hashtable (pandas/hashtable.c:22984)
AttributeError: 'module' object has no attribute 'dtype'
EDIT:
Thanks to the comments! I had tried re-installing pandas, numpy, and Quandl. But it was all due to the fact I had renamed a helper script numbers.py, when it needed to draw that from within. Hint to all future users: Do not rename python scripts to existing module types.
I've had a similar error that was caused by installing a package while I had IPython running. Try reinstalling Pandas using pip (make sure all Python instances are closed) and maybe you'll have to reiinstall hashtable as well, I can't remember.
try to reinstall this Quandl library
File
"/Users/peter/Documents/Trading/Code/AlphaModelVer1/numbers.py", line
2, in
import Quandl
pip uninstall Quandl
pip install Quandl
This problem occurred with me in spite of not naming the script name to the existing module name. I tried the following and it worked.
Instead of "import Quandl", I did "from Quandl import Quandl" and it worked for me!