1

I hava two different files: data_source and util. I import util at data_source like this:

from util import HttpUtil

But there is some error when I run

from util import HttpUtil

ImportError: cannot import name HttpUtil

How can I solve this?

This is the directory structure of the module: enter image description here

In util

 class HttpUtil(object):

   @staticmethod   
   def request(host, port, method):

In data_source

import json  
import urllib   
import time   
from util import HttpUtil
SeaBiscuit
  • 11
  • 5

1 Answers1

0
  • Do check if there really exists a HttpUtil function defined in utils. For instance, do watch out for spelling or casing errors.
  • Post the .py files for reference, in case the error persists.