×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    2

    SOL_SOCKET - Attribute Error - Python for S60 v1.4.2

    Hello,

    I am running Python for S60 V 1.4.2 and am attempting to run a python script that opens a socket and then set socket settings:

    import socket
    ...
    listenSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    listenSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

    The script runs fine on the desktop, but errors when I run it on the phone with the following message:

    AttributeError: 'module' object has no attribute 'SOL_SOCKET'

    Do I need to install or modify something in the socket module to set the socket option on the phone?

    Thanks.

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    UK
    Posts
    125

    Re: SOL_SOCKET - Attribute Error - Python for S60 v1.4.2

    Quote Originally Posted by dfabbri View Post
    AttributeError: 'module' object has no attribute 'SOL_SOCKET'
    Looks like the module author has neglected to expose that constant in the socket module. You should probably file a bug report on SourceForge.

    In the meantime, it's just an integer value, and looking at http://www.forum.nokia.com/document/...8h-source.html it seems to be '1'. So, you can put something like...

    Code:
    import socket
    try:
        socket.SOL_SOCKET
    except AttributeError:
        socket.SOL_SOCKET = 1
    ...at the top of the code.

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    2

    Re: SOL_SOCKET - Attribute Error - Python for S60 v1.4.2

    The fix for SOL_SOCKET appears to work; however, the function setsockopt does not appear to be implemented.

    The code used is:

    listenSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

    Gives the error:

    in setsockopt error: (88, 'Function not implemented')

    Any thoughts on how to get the full socket module implementation?

    Thanks.

  4. #4
    Regular Contributor
    Join Date
    Mar 2003
    Location
    UK
    Posts
    125

    Re: SOL_SOCKET - Attribute Error - Python for S60 v1.4.2

    Quote Originally Posted by dfabbri View Post
    Any thoughts on how to get the full socket module implementation?
    Either write it yourself, or log a request on http://sourceforge.net/tracker/?atid...55&func=browse

Similar Threads

  1. Replies: 4
    Last Post: 2006-09-05, 15:15

Posting Permissions

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