×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    6

    BaseHTTPServer module for S60 Python

    Hello everyone,

    is there anything like a BaseHTTPServer module for S60 Python or how do I activate it if it is included (import BaseHTTPServer doesn't work)?

    Thanks a lot for an answer

    Bye

  2. #2
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Helsinki
    Posts
    376

    Re: BaseHTTPServer module for S60 Python

    Quote Originally Posted by sledgehammer89 View Post
    Hello everyone,

    is there anything like a BaseHTTPServer module for S60 Python or how do I activate it if it is included (import BaseHTTPServer doesn't work)?

    Thanks a lot for an answer

    Bye
    Check PyS60 source code or PyS60 distribution whether this particular class is available.

    If it's not there is a chance that you can just copy it over from Windows Python 2.2.2 distribution.
    Mikko Ohtamaa

    http://mfabrik.com
    http://blog.mfabrik.com

  3. #3
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Karachi, Pakistan
    Posts
    277

    Re: BaseHTTPServer module for S60 Python

    Hello,

    I have been trying to use BaseHTTPServer module from Python 2.2.2 distribution, but it looks like its not compatible with PyS60 1.4.4.

    Do I have to make any modifications in BaseHTTPServer module to make it work?

    Here's the code I'm using:

    Code:
    import BaseHTTPServer
    
    class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
    
        def do_GET(self):
            if self.path != "/":
                self.send_error(404, "File not found")
                return
            self.send_response(200)
            self.send_header("Content-type", "text/html")
            self.end_headers()
            try:
      	    self.wfile("hello world!")
            except:
                print("** ERROR!")
    
    PORT = 8000
    
    httpd = BaseHTTPServer.HTTPServer(("127.0.0.1", PORT), Handler)
    print "** Serving at port", PORT
    httpd.serve_forever()
    And this is the error I get on the phone:
    Code:
    Version 1.4.4 final
    Traceback (most recent call last):
      File "E:\private\2000b1a5\default.py", line 81, in menu_action
        f()
      File "E:\private\2000b1a5\default.py", line 65, in query_and_exec
        execfile(script_list[index][1].encode('utf-8'), script_namespace.namespace)
      File "e:\python\http_server.py", line 24, in ?
        httpd = BaseHTTPServer.HTTPServer(("127.0.0.1", PORT), Handler)
      File "e:\python\lib\SocketServer.py", line 330, in __init__
        self.server_bind()
      File "e:\python\lib\BaseHTTPServer.py", line 102, in server_bind
        host, port = self.socket.getsockname()[:2]
      File "<string>", line 1, in getsockname
    error: Not Implemented feature
    I'm using the SocketServer and BaseHTTPServer from Python 2.2.2 distribution. I'd also like to use SimpleHTTPServer and CGIHTTPServer once I make this working.

    Any help would be greatly appreciated.

    // chall3ng3r //
    Faisal Iqbal (skype: chall3ng3r)
    Flash Mobile Specialist | Orison Technologies
    _____________________________________
    blog: F·L·A·S·H·I·S·M
    swf2go: www.swf2go.com

  4. #4
    Super Contributor
    Join Date
    May 2004
    Location
    Tampere, Finland
    Posts
    524

    Re: BaseHTTPServer module for S60 Python

    I cannot even get that far with PyS60 1.4.2 on my N95:

    Code:
    Traceback (most recent call last):
      File "ped.py", line 1366, in run_click
      File "E:\Python\httpserver.py", line 19, in ?
        httpd = BaseHTTPServer.HTTPServer(("127.0.0.1", PORT), Handler)
      File "E:\Python\lib\SocketServer.py", line 329, in __init__
        self.server_bind()
      File "E:\Python\lib\BaseHTTPServer.py", line 94, in server_bind
        SocketServer.TCPServer.server_bind(self)
      File "E:\Python\lib\SocketServer.py", line 339, in server_bind
        self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    AttributeError: 'module' object has no attribute 'SOL_SOCKET'
    Did you modify SocketServer.py or BaseHTTPServer.py (from Python 2.2.2 source distribution) in any way?

  5. #5
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Helsinki
    Posts
    376

    Re: BaseHTTPServer module for S60 Python

    At least you need to select socket access point before you can use socket functions.
    Mikko Ohtamaa

    http://mfabrik.com
    http://blog.mfabrik.com

Similar Threads

  1. Camera Python Module
    By vp in forum Symbian
    Replies: 4
    Last Post: 2008-09-22, 09:56
  2. Replies: 4
    Last Post: 2008-04-14, 03:23
  3. Replies: 3
    Last Post: 2008-02-09, 13:05
  4. Replies: 2
    Last Post: 2007-10-18, 00:02
  5. Carbide.j 1.5 and Netbeans 5.5 beta 2
    By ovjo12 in forum Mobile Java Tools & SDKs
    Replies: 5
    Last Post: 2007-06-11, 05:43

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×