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 7952923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:00:31+00:00 2026-06-04T03:00:31+00:00

I have the following simple Threaded fileserver to be used by my application: class

  • 0

I have the following simple Threaded fileserver to be used by my application:

class FileServer(Thread):
    """Simple file server exposing the current directory for the thumbnail
    creator
    """

    def __init__(self, port):
        Thread.__init__(self)
        self.port = port

        Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
        self.httpd = SocketServer.TCPServer(("", port), Handler)

    def run(self):
        self.httpd.serve_forever()

    def stop(self):
        self.httpd.shutdown()

How can I prevent SimpleHTTPServer to output “GET ‘http:// BLA BLA BLA” at every request? Thanks

  • 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-04T03:00:33+00:00Added an answer on June 4, 2026 at 3:00 am

    You can subclass SimpleHTTPServer.SimpleHTTPRequestHandler and override the log_message method. Here is the method you will be overriding, sans docstring:

    def log_message(self, format, *args):
        sys.stderr.write("%s - - [%s] %s\n" %
                         (self.address_string(),
                          self.log_date_time_string(),
                          format%args))
    

    So to simply ignore all messages, replace the body of the function with pass. For more fine-grained control (i.e if you still want error messages printed), you may instead override the log_request and/or log_error methods. Original methods are like this:

    def log_request(self, code='-', size='-'):
        self.log_message('"%s" %s %s',
                         self.requestline, str(code), str(size))
    
    def log_error(self, format, *args):
        self.log_message(format, *args)
    

    From 2.7 to 3.1 the module names change, but these methods are unchanged.

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

Sidebar

Related Questions

I have following simple class: @interface Article: NSObject { NSString *title; } @property (copy,
I have the following simple methods for writing a python object to a file
I have the following simple Java code: package testj; import java.util.*; public class Query<T>
I have a multi-threaded console application acting as a server. The server spawns a
I have the following (simple) mapping: @Entity public class Role { @OneToMany( fetch =
I have the following simple page; <%@ Import namespace=System.IO %> <script runat=server> int pageSize
I have a simple multi-threaded program, with the following structure. public void someFunction() {
I have coded a single threaded client server model which does following: Server loops
I have the following simple models: class Event < ActiveRecord::Base has_many :participations has_many :users,
We have the following simple Stored Procedure that runs as an overnight SQL server

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.