Python zeep : AttributeError: 'lxml.etree.QName' object has no attribute 'resolve' - python

I have just installed ‘zeep’ (used suds before), with the command:
pip install lxml==3.7.3 zeep
I am getting the error:
self.item_type = self.item_type.resolve()
AttributeError: 'lxml.etree.QName' object has no attribute 'resolve'
The same wsdl loads correctly using netbeans JAX-WS Web Services.

Related

module object has no attribute parse_spec

Environment:-
OS : Ubuntu20.04
Python:2.7.18
Problem:-
I have gerrit trigger plugin installed in jenkins., while building my patch-set it always fails with below error
gbp parse spec failed. 'module' object has no attribute 'parse_spec'
I have already installed git-buildpackage-rpm package still getting the same error.

Attribute error: module 'requests' has no attribute 'Session' in pandas-DataReader

I am trying to follow this tutorial. However the line:
portfolio = web.DataReader(name=symbol, data_source='quandl', start=start, end=end)
is causing errors. After looking at the documentation, I have converted it to:
portfolio = pdr.DataReader(name=symbol, data_source='quandl', start=start, end=end)
but I still get the same error:
AttributeError: module 'requests' has no attribute 'Session'
this is being called from:
"/home/john/.conda/envs/optimizer/lib/python3.8/site-packages/pandas_datareader/_utils.py"
Also fails the same as this question. (Question closed with no solution)
Recreate
conda install pandas
conda install -c anaconda pandas-datareader
$ python
>>> import requests
>>> requests.Session()
AttributeError: module 'requests' has no attribute 'Session'
According to this request, that should work, but it does not. I think the error is with requests, not with pandas-datareader.
Edit :: added more information
check your spelling.
It should have been requests.session() not requests.Session()

AttributeError: module 'feedparser' has no attribute 'FeedParserDict'

I am trying to import feedparser in Python, and want to call FeedParserDict from the library feedparser, i.e., feedparser.FeedParserDict. But it leads to the following error:
"AttributeError: module 'feedparser' has no attribute 'FeedParserDict'."
Does it mean that "FeedParserDict" is not in the library feedparser (version 5.2.1). I find that "FeedParserDict" is present in previous version of feedparser (i.e., version 3.3). How can I cope with this error?
I've pip install feedparser==5.2.1 and "FeedParserDict" is present in it
import feedparser
print(feedparser.__version__)
print(feedparser.FeedParserDict)
output:
5.2.1
<class 'feedparser.FeedParserDict'>

Eclipse PyDev AttributeError: 'module' object has no attribute

I am trying to connect to the shopify api but am having difficulty connecting when using Eclipse+PyDev. When connection via python in a bash shell the same commands work OK
to install:
pip3 install --upgrade ShopifyAPI
shopify.py (my code)
import shopify
shop_url = "https://APIKEY:PASSWORD#mystore.myshopify.com/admin/products.json
shopify.ShopifyResource.set_site(shop_url)
The reference to shopify.ShopifyResouce.. throws the following in PyDev:
AttributeError: 'module' object has no attribute 'ShopifyResource'
I think it may be due to relative imports in the shopify module (the same code works fine in a terminal).
In shopify.py: (shopify API)
from shopify.resources import *
in shopify.resources: (shopify API)
from ..base import ShopifyResource
When I run
from shopify.base import ShopifyResource
ShopifyResource.set_site(shop_url)
I get ImportError: No module named 'shopify.base'; 'shopify' is not a package
Any ides how I can fix this?
The problem might be you created a shopify.py file in your IDE rename that file and that error will be solved

Scapy AttributeError on every call: 'module' object has no attribute '*'

I have installed Scapy from the package repos on my Ubuntu machine (Python 2.7), and I am trying to run this code from a file:
import scapy
dg = scapy.IP()
pcap = scapy.rdpcap("../tst/Http.cap")
scapy.send(IP())
Running gives the error,
AttributeError: 'module' object has no attribute 'IP'
Comment out the IP call on line 3 and running gives the error,
AttributeError: 'module' object has no attribute 'rdpcap'
Also comment out line 4 and you get,
AttributeError: 'module' object has no attribute 'send'
Curously, this code fails when invoked with ''python '', but it works as expected when I manually enter each command into the Python shell. I have observed this behaviour on three fresh Python installs - two in Ubuntu, and one in Windows. Can anyone else see the cause of this error?
You need to import Scapy into the global namespace.
From the Scapy module documentation -
Note: In Scapy v2 use from scapy.all import * instead of from scapy import *.
Also found in "Using Scapy to build your own tools".
So your code should be -
from scapy.all import *
dg = IP()
pcap = rdpcap("../tst/Http.cap")
send(IP())

Categories