AttributeError: 'MyTopo' object has no attribute 'addlink' - python

Heading
I got the error ( attributeerror. 'MyTopo' object has no attribute 'addlink' ) when I tried running the "Fat-tree topology.py" script in mininet .Please help.

First, you have to be sure you imported the mininet library.
The fuction you need is called addLink, not addlink, which caused your error.

Related

AttributeError: module 'socket' has no attribute 'setblocking'

I'm trying to use 'non-blocked socket' for a Python project
(see previous question if anyone has a better answer : How to use a socket without waiting in python )
I saw that people on the site suggested using the command:
socket.setblocking ()
But when I run the program it crashes, and the error is recorded:
AttributeError: module 'socket' has no attribute 'setblocking'
How can I fix this?
And is there another way?
It looks like you are trying to call setblocking() on the module called socket rather than on the object called socket.
Change your code to something like:
import socket
s = socket.socket(...)
s.setblocking(...)

'gi.repository.GObject' object has no attribute 'threads_init' while excuting bundle build by cx_freeze

I built my application with cx_freeze in python3. When I execute the application, it report that:
AttributeError: 'gi.repository.GObject' object has no attribute 'threads_init'
As check the code of GObject.py and GLib.py, it is said that threads_init is now obseleted, I try to remove threads_init from GObject.py, but get the same result, problem remain unsolved.
Could anyone give me a hand? Thank you in advanced.

Why does my .scan function from the Python-NMAP module show 'str' Attribute Error?

I installed first the nmap module in PyCharm but received as many others the error for my nmap.PortScanner function.
Therefore, I uninstalled nmap and installed python-nmap.
Now, I have however the problem with executing the command:
import nmap
ns = nmap.PortScanner
ns.scan('My.IP.Add.ress', '1-1024', '-v')
print(ns.scaninfo())
I get for the second line the error message:
AttributeError: 'str' object has no attribute '_nmap_path'
However, watching all examples of this, show precisely these lines of code.
Can somebody please explain what is happening?
My editor also shows for ns.scaninfo() a warning that the parameter 'self' is not filled. Again, this is not what the examples show. I am very confused by this.
As always, thank you very much for your help!
(Since posting my comment I've become convinced that it is the root cause, so posting as an answer.)
You're missing some brackets on the second line. It should read:
ns = nmap.PortScanner()
As it is, you're storing the PortScanner class in ns, as opposed to an object of that class. This means that when you call ns.scan its first parameter (which it's expecting to be self, the PortScanner object with an _nmap_path attribute) is actually a string, which doesn't have the attribute. The same reason is behind your editor's warning about the self parameter not being filled, too.

Not able find Twython.getFollowersIDs functions

I am using Twython on Ubuntu 12.04 an when I write this line
twitter.getFollowersIDs(screen_name='someName')
I am getting this error
AttributeError: 'Twython' object has no attribute 'getFollowersIDs'
what should I do?
I think the correct method name is:
twitter.get_followers_ids(screen_name='someName')
If this is not the case please provide the output of dir(twitter).

PyXB says AttributeError: 'module' object

I have problems creating a python binding for a WSDL file using PyXB. I do:
pip install pyxb (currently version 1.1.5)
pyxbwsdl http://dic.googlecode.com/files/GoogleSearch.wsdl
I get "AttributeError: 'module' object has no attribute 'CreateFromDOM'" and no code is generated. For another WSDL document I get the same error.
Can someone give me a clue?
Thanks!
Full stack trace:
ERROR: Unable to convert DOM node {http://www.w3.org/2001/XMLSchema}schema to Python instance
Traceback (most recent call last):
File "/home/boehlke/.virtualenvs/env/local/lib/python2.7/site-packages/pyxb/binding/basis.py", line 2047, in append
value = mr.module().CreateFromDOM(node)
AttributeError: 'module' object has no attribute 'CreateFromDOM'
It turned out that "AttributeError: 'module' object..." is an expected error. I found this comment in the source code, where the error occurs :-)
# The module holding XMLSchema bindings
# does not have a CreateFromDOM method,
# and shouldn't since we need to convert
# schema instances to DOM more carefully.
# Other namespaces won't have a module if
# the bindings were not imported; this is
# probably worth a warning.

Categories

Resources