Home > OS >  Module 'dateutil' has no attribute 'parser' - Dateutil - Python
Module 'dateutil' has no attribute 'parser' - Dateutil - Python

Time:11-07

I am trying to download a pre-trained tensorflow model. I am using the below code

import numpy as np
import time
import PIL.Image
import IPython.display as display
import matplotlib.pylab as plt
import tensorflow as tf
import tensorflow_hub as hub
import datetime
from tensorflow.keras.preprocessing import image
from dateutil import parser

from keras.applications.inception_v3 import InceptionV3
model = InceptionV3()
model.summary()

I am getting the following error

AttributeError: module 'dateutil' has no attribute 'parser'

I am using python -3.7 and TF-2.7, python-dateutil-2.8.1

Please help me fix this. Thank You :)

CodePudding user response:

The correct import syntax is:

import dateutil.parser

and then:

parser.parse(time_string)

or:

from dateutil.parser import parse
parse(time_string)

Documentation: https://dateutil.readthedocs.io/en/stable/parser.html

  • Related