Can not find a specific regular expressions - python

I am trying to scrap specific information from the site but I am receiving an error. Here is the simplified version of the main problem:
import re
b='href="/bp/vendor?vendorCodes=C901U">C901U</a></span></div></div></div><div heyaa'
c=re.search('href="/bp/vendor?vendorCodes=C901U">C901U</a></span></div></div></div><div',b)
If I try to find what is in c I receive this error:
c.group()
Traceback (most recent call last):
File "<pyshell#87>", line 1, in <module>
c.group()
AttributeError: 'NoneType' object has no attribute 'group'
Thanks in advance.

Related

I'm getting an attribute error using tensorflow

I'm pretty new to python and this code is for object detection, it works fine on my webcam but has an error when using an external camera
This is what I have:
for classId, confidence,box in zip(classIds.flatten(),confs.flatten(),bbox):
cv2.rectangle(img,box,color=(0,255,0),thickness=2)
cv2.putText(img,classNames[classId-1].upper(),(box[0]+10,box[1]+30),
cv2.FONT_HERSHEY_COMPLEX,1,(0,255,0),2)
Here's the message I got:
Traceback (most recent call last):
File "C:/Users/byeo9/PycharmProjects/FYP-ENV/Testing 2.py", line 31, in <module>
for classId, confidence,box in zip(classIds.flatten(),confs.flatten(),bbox):
AttributeError: 'tuple' object has no attribute 'flatten'

How to get namespace details for ecs

I want to print namespaces for my ecs-client. When I am using print(client.user_info.whoami()) I am getting the output. But when I am executing the below code I am getting attribute error.
from ecsclient.client import Client
from ecsclient.common.multitenancy import namespace
client = Client('3',
username='root',
password='password',
token_endpoint='https://abc.xyz.com:4443/login',
ecs_endpoint='https://abc.xyz.com:4443')
print(client.namespace.get_namespaces())
Error:
Traceback (most recent call last):
File "test.py", line 12, in <module>
print(client.namespace.get_namespaces())
AttributeError: 'Namespace' object has no attribute 'get_namespaces'
instead of using print(client.namespace.get_namespaces()) I used print(client.namespace.list()) and got the list of namespaces

Python - AttributeError: module 'cssutils' has no attribute 'getUrl'

I am trying to extract URLs from CSS stylesheet using cssutils.getUrls('stylesheet.css')
However when I run the code I get an error complaining about 'getUrls' see below. I am running on python 3.6
import cssutils
cssutils.getUrls('http://4nprofessionals.com/css/style.css')
Traceback (most recent call last):
File "", line 1, in
cssutils.getUrls('http://4nprofessionals.com/css/style.css')
AttributeError: module 'cssutils' has no attribute 'getUrls'

Why plone.api doesn’t have find?

I trying create a script to find a exist folder, if not create this folder.
But when a call find from plone.api the output is AttributeError: 'module' object has no attribute 'find'
Bellow my terminal:
$ bin/instance -O intranet debug
>>> from plone import api
>>> from zope.site.hooks import setSite
>>> portal = app['intranet']
>>> setSite(portal)
>>> folders = api.content.find(context=portal, portal_catalog='Folder')
Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'find'
>>>
What is wrong in my case?
I used this documentation plone.api.content.find
Need update plone.api to a version with support to method find. Like said by #LucaFabbri. In my case the product was update to 1.5.0.

fuzzy installed successfully but fuzzy.Soundex(4) has problems in python

Code:
>>> import fuzzy
>>> soundex = fuzzy.Soundex(4)
Error:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
soundex = fuzzy.Soundex(4)
AttributeError: 'module' object has no attribute 'Soundex'
I really don't know why, please help if you know about it!

Categories