module object has no attribute parse_spec - python

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.

Related

AttributeError: module 'IPython.core' has no attribute 'shadowns'

I'm running these lines
import dill
dill.load_session("session2.pkl")
and getting the error AttributeError: module 'IPython.core' has no attribute 'shadowns'.
I've saved this session on Google Colab Notebooks. How can I get rid of the error?
I used the simple workaround:
import IPython
IPython.core.shadowns = 1
For some extra packages missing like google or google.colab, I used
%%bash
mkdir google/colab
touch google/colab/__init__.py

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'>

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

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.

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