Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8931715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:10:16+00:00 2026-06-15T09:10:16+00:00

I try to run first example from python wiki and when I try to

  • 0

I try to run first example from python wiki and when I try to run it:

$ python BaseHttpServer.py

I get an error AttributeError: ‘module’ object has no attribute ‘BaseHTTPRequestHandler’.

I tested it on Python 2.7.3 on Linux Mageia 2 64-bit:

Traceback (most recent call last):
  File "BaseHTTPServer.py", line 9, in <module>
    import BaseHTTPServer
  File "/home/vanveber/BaseHttpServer/BaseHTTPServer.py", line 14, in <module>
    class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
AttributeError: 'module' object has no attribute 'BaseHTTPRequestHandler'

And it on Python 2.7.3 on Windows 7 64-bit

Traceback (most recent call last):
  File "BaseHTTPServer.py", line 11, in <module>
    from BaseHTTPServer import BaseHTTPRequestHandler
  File "C:\BaseHttpServer\BaseHTTPServer.py", line 11, in <module>
    from BaseHTTPServer import BaseHTTPRequestHandler
ImportError: cannot import name BaseHTTPRequestHandler

BUT!

  1. BaseHttpServer is a class from standard Python library.
  2. If I write and run this code from Python GUI on Windows it works correctly!

What is a problem and why?!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:10:17+00:00Added an answer on June 15, 2026 at 9:10 am

    Solution: Rename the python file.

    Explanation: BaseHTTPServer is a module in the standard library. When you have a python file called BaseHTTPServer.py in your local directory, you will hide the standard library module, and you can no longer import it, because the statement

    import BaseHTTPServer
    

    will not import the standard library module, but the local BaseHTTPServer.py module.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get this error on my application when i try to run in Tomcat,
I'm getting this error when I try run DB:Rake : ** Invoke db:migrate (first_time)
I try to run the following script in R (minimized example): library(neuralnet) arrhythmia <-
I am trying to run the example code from the MATLAB Doc, but when
Background: I mostly run python scripts from the command line in pipelines and so
I opened Terminal from my MacBook Pro, and try to run some bash script
I try run jconsole with jar that contains my classes like: cd C:\Program Files\Java\jdk1.6.0_26\bin
I try to run a medium sized programm with a lot of external jars
I try to run the following raw query in android, it seems not work
I try to run jsf application in myeclipse using jboss web server and following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.