PyXB says AttributeError: 'module' object - python

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.

Related

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

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.

Python calling DLL: TypeError: 'LibraryLoader' object is not callable

I am trying to import a DLL into Python 2.7.12 64 bit using ctypes. To narrow down the scope for errors I used Microsoft's MathLibrary DLL example and built my own based on these instructions (https://msdn.microsoft.com/en-GB/library/ms235636.aspx). I built it as x64 release and copied the resulting dll into C:\ root to eliminate path length or spelling error issues. My machine us running Windows 7 Pro 64 Bit.
My python code is:
from ctypes import cdll, windll, c_long, c_int, create_string_buffer
test_dll = windll("C:\\MathLibrary.dll")
add = test_dll.add
When run it reports the following:
Traceback (most recent call last):
File "C:\temp.py", line 3, in <module>
test_dll = windll("C:\\MathLibrary.dll")
TypeError: 'LibraryLoader' object is not callable
Can anyone advise what might be the issue?
Thanks
Andy
Update:
#eryksun comment - this removed the LibraryLoader error. However I am now struggling to access the add function and get this error:
add = test_dll.add
File "C:\Python27\lib\ctypes\__init__.py", line 375, in __getattr__
func = self.__getitem__(name)
File "C:\Python27\lib\ctypes\__init__.py", line 380, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'add' not found
windll is an object from the ctypes module. It can't be invoked like a function ('object is not callable'). You probably want to reference one of its methods and invoke it.
test_dll = windll.<func_name>("C:\\MathLibrary.dll")
you can use __dir__() to see the objects attributes and methods, or better yet, check the documentation.
Use 'cdll' would produce a similar error message "TypeError: 'LibraryLoader' object is not callable". Use 'CDLL' work well, so the problem is from case sensitive of the 'cdll' and possibly 'windll' as well.
You can try:
test_dll = windll.LoadLibrary("C:\\MathLibrary.dll")

Python: AttributeError: 'str' object has no attribute 'decompressUnknownOriginalSize'

First off, I'm not a programmer by any means. I just try to follow instructions.
So, I'm trying to use a script to decode game files. The problem is that I'm getting an error.
I've tried the script on 2 different machines wheres both give the same error. At the same time, I have friends using the exact same script w/o getting this error. Does anyone have any clue what is wrong?
Traceback (most recent call last):
File "F:\Frostbite Decoding\Decoding Files\bf4dumper.py", line 258, in <module>
if "tocRoot" in locals(): dumpRoot(tocRoot)
File "F:\Frostbite Decoding\Decoding Files\bf4dumper.py", line 249, in dumpRoot
dump(fname,targetDirectory)
File "F:\Frostbite Decoding\Decoding Files\bf4dumper.py", line 198, in dump
LZ77.decompressUnknownOriginalSize(catEntry.path,catEntry.offset,catEntry.size,targetPath)
AttributeError: 'str' object has no attribute 'decompressUnknownOriginalSize'
If you need anymore information, please let me know.
Python is saying that it is receiving a string and that there is no method for decompressUnknownOriginalSize. This sounds like the script needs to get some other data type or argument type than string. Look for where "decompressUnknownOriginalSize" is called and see what data type is being passed to that argument.

adding list item to list object has no attribute '__getitem__'

I am very confused why the code below doesn't work under Python 2.7.6 in OS X.
Code should basically iterate through one list and add items to another list (I want to add conditions later)..
import os
home_dir = os.listdir("/Users/")
users_list = []
for user in home_dir:
users_list.append(user)
I get the error message below when running it:
Traceback (most recent call last): File "myfile.py", line x, in
<module>
users_list.append[suser] TypeError: 'builtin_function_or_method' object has no attribute '__getitem__'
/edit: weirdly enough when I do the same thing outside of the file in the python interpreter it seems to work ok?
You should really show the real code which produces the error.
Taken from the Traceback:
users_list.append[suser] - this is wrong
users_list.append(suser) - this is correct

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).

Categories

Resources