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"
Related
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
Currently I am using Python 3.7, and Ubuntu 18.04. I downloaded wxPython from pip, but when I tried to import wx in my terminal, I get this error:
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/aleejandrof/anaconda3/lib/python3.7/site-packages/wx/__init__.py", line 17, in <module>
later on, when I tried other ways like and "._core import" I received an error like this:
ImportError: /home/aleejandrof/anaconda3/bin/../lib/libpangoft2-1.0.so.0: undefined symbol: pango_font_description_set_variations
After reading some posts here, I tried deleting the wx.py and wx.pyc files, which didn't work. The same happened when I read that downloading the main excecutable file would make the import occur with no errors, but it popped the same errors.
AttributeError: module 'wx' has no attribute '__version__'
I am trying to run a GUI pipeline, which works with wxPython. I'm thankful in advance, if any of you has suggestions.
When I made an environment of ubuntu18.04 using docker, ran into the same problem.
I had multiple libpangoft2-1.0.so.0 files.
It seemed the problem was /opt/conda/lib/libpangoft2-1.0.so.0 was looked up.
To change the name of the file solved the problem.
find / -name libpangoft2-1.0.so.0
/opt/conda/lib/libpangoft2-1.0.so.0
/opt/conda/pkgs/pango-1.42.4-h049681c_0/lib/libpangoft2-1.0.so.0
/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0
mv /opt/conda/lib/libpangoft2-1.0.so.0 /opt/conda/lib/libpangoft2-1.0.so.0-void
You may want to try:
conda install -c asmeurer pango
I really really need your help please. The fact is my problem should seem pretty simple to you.
So I have a macbook with Lion, I use python 3.3. In order to use GDAL for GIS? I downloaded the package on this website, which is recommended everywhere:
http://www.kyngchaos.com/software/frameworks
Then I install it. It is ok, but I cannot import it in my project, here is my error.
When I type import osgeo, I have the following :
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
import osgeo
ImportError: No module named 'osgeo'
I know my path is not good, wherecan I change it ?
Any ideas?
I installed this library called Polygon, in Python 2.7.3. But, each time I import it I get the next error message :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Polygon/__init__.py", line 5, in <module>
from Polygon.cPolygon import *
ImportError: No module named cPolygon
I have no idea about what could be going wrong. And also, I have already tried to contact the original author of this on his personal webpage.
but he hasn't replied though :( I wonder if someone can help me with this issue please.
It sounds like you didn't in fact install it, but instead just copied it to your working directory. As always, run setup.py with the appropriate arguments to install.
This error can happen if you try to run python from inside the directory you used to install Polygon. Move to a different directory and try again.
I did the Nodebox tutorial on the graph library:
http://nodebox.net/code/index.php/Graph#loading_the_library
I installed the library in Application Support
I pasted the following code:
graph = ximport("graph")
create(iterations=1000, distance=1.0, layout="spring", depth=True)
And I got this error message:
Traceback (most recent call last):
File "nodebox/gui/mac/__init__.pyo", line 358, in _execScript
File "mypath", line 2, in <module>
NameError: name 'create' is not defined
And before that I got this:
NameError: name 'ximport' is not defined
If I close the file and reopen and just say graph = ximport("graph")
Nothing happens (it seems to work).
I think it would be a very cool library to work with.
Any help would be great.
The problem is with your Path, as the tutorial link that you pointed to said:
Put the graph library folder in the same folder as your script so NodeBox can find the library. You can also put it in ~/Library/Application Support/NodeBox/.
Otherwise install content from the graph.zip
and do
import graph
graph.create
Sorry, I don't have MAC to try these. But the error messages are saying that Python is not able to find your modules properly. For python to find it, they should be in the current directory or in the PYTHONPATH.