Tag Archives: module XXX has no attribute

[Solved]AttributeError: module ‘urllib’ has no attribute ‘quote’

AttributeError: module’urllib’ has no attribute’quote’ solution.
In crawling Google pictures, the program reported an error. Due to the different versions of python, the problem of AttributeError: module’urllib’ has no attribute’quote’ appeared
as long as the quote Just add parse before

url_init = url_init_first + urllib.quote(keyword, safe='/')
url_init = url_init_first + urllib.parse.quote(keyword, safe='/')

[How to Solve]AttributeError: module ‘scipy’ has no attribute ‘io’

The problem of io loading .mat data and imread reading pictures under Scipy

When we need to load MATLAB’s .mat file, if we use:

import scipy.misc 
import scipy.io
import os
cwd  = os.getcwd()
data = scipy.io.loadmat(cwd + "/data/imagenet-vgg-verydeep-19.mat")

Will report an error:
AttributeError: module’scipy’ has no attribute’io’

 

The reason for this may be that the submodules under scipy cannot be imported directly.

from scipy import io

Finally changed to:

import scipy.misc 
from scipy import io
import os
cwd  = os.getcwd()
data = io.loadmat(cwd + "/data/imagenet-vgg-verydeep-19.mat")

problem solved.

Also use the imread function under Scipy.misc,

import scipy.misc 
cwd  = os.getcwd()
VGG_PATH = cwd + "/data/imagenet-vgg-verydeep-19.mat"
IMG_PATH = cwd + "/data/cat.jpg"
input_image = imread(IMG_PATH)

appear:
AttributeError : ‘module’ object has no attribute’imread ‘

This is sometimes because you do not have pillow dependency packages

pip install pillow

This is how I solved it.

[How to Solve] Tesorflow: module ‘pandas.core.computation’ has no attribute ‘expressions’

Error Message: Tesorflow:module ‘pandas.core.computation’ has no attribute ‘expressions’

There are totally two methods to solve this error. Let’s check out them.

Method 1:

Just upgrade dask, directly under cmd, pip install –upgrade dask, (Pycharm directly enter it in the terminal), and then prompt Successfully installed after completion.

Insert picture description here

 

Method 2:

This method is a more usable and well-tested.

conda update dask

Tensorflow error: attributeerror: module ‘tensorflow_ API. V1. Train ‘has no attribute’ summarywriter ‘

TensorFlow Error: AttributeError: module ‘tensorflow._api.v1.train’ has no attribute ‘SummaryWriter’ etc.
Analysis: Version update, method call method change
Solution.

Error oRIGINAL METHOD NEW METHOD
AttributeError: module ‘tensorflow._api.v1.train’ has no attribute ‘SummaryWriter’ tf.train.SummaryWriter() tf.summary.FileWriter()
AttributeError: module ‘tensorflow’ has no attribute ‘merge_all_summaries’ tf.merge_all_summaries() tf.summary.merge_all()
AttributeError: module ‘tensorflow’ has no attribute ‘histogram_summary’ tf.histogram_summary() tf.summary.histogram()
AttributeError: module ‘tensorflow’ has no attribute ‘scalar_summary’ tf.scalar_summary() tf.summary.scalar()
AttributeError: module ‘tensorflow’ has no attribute ‘image_summary’ tf.image_summary() tf.summary.image()
AttributeError: module ‘tensorflow’ has no attribute ‘audio_summary tf.audio_summary() tf.summary.audio()
AttributeError: module ‘tensorflow’ has no attribute ‘merge_summary’ tf.merge_summary() tf.summary.merge()