×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Sep 2009
    Posts
    285

    Error using 'location' library while determining cell id

    Hi!

    I am facing a strange problem - I was hoping someone has a clue as to why this
    happens..

    I have created an application that needs to get the network information - cell
    id, etc. Hence, in my code, I have the following snippet -
    Code:
    ...
    import location
    a, b, c, d = location.gsm_location()
    ...
    However, when I run the code, I get the following error -
    a, b, c, d = location.gsm_location()
    TypeError: unpack non-sequence
    This error occurs as the output to the above statement is 'NULL', instead of
    the (four) location values. I thought that this was due to insufficient (or incorrect)
    capacities set to the shell script file. But when I run the same command in
    the interpreter, the command works fine! In fact, I even created a new sis
    file, with a script that contains only the above two lines, and the
    application gives the correct output.

    Does anyone have any idea why the application throws an error only when the
    snippet is part of an application and not when I make a new application with
    just the above two lines? I know it sounds ridiculous, but this problem has
    left me totally confused!

    To build the sis file, I wrote the Python script and used SisContents to
    create a sis file that stores the script in 'C:\\Python'.

  2. #2
    Regular Contributor
    Join Date
    Sep 2009
    Posts
    285

    Re: Error using 'location' library while determining cell id

    Hi!

    I seemed to have figured out the problem, but still have no clue why the error is occurring.

    The problem is with a GPRS connection that I have opened a little prior to my call of location.gsm_location.
    The code is -
    Code:
    <..snip..>
    conn = httplib.HTTPConnection("www.python.org")
    conn.request("GET","/index.html")
    r = conn.getresponse()
    d = r.read()
    conn.close()
    X, Y = d.split("</head>\n")
    date, Z = Y.split("\n<body>")
    str_out = str_out + date+"\n\n"
    import location
    a, b, c, d = location.gsm_location()
    <..snip..>
    Somehow, despite giving the conn.close() command, the GPRS connection still seems to be active. I can see the small gprs icon on the top left of the screen. Whenever GPRS is working, the location module does not work.

    I guess the whole problem boils down to closing the gprs connection. Any idea how that is done? This conn.close() does not seem to be doing the trick. In fact, the only way I can get rid of the "gprs active" icon (top-left) is if I shut down the application and re-open it.

    Any suggestions?

    Thanks

  3. #3
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,796

    Re: Error using 'location' library while determining cell id

    Quote Originally Posted by kedarm View Post
    Hi!

    I seemed to have figured out the problem, but still have no clue why the error is occurring.

    The problem is with a GPRS connection that I have opened a little prior to my call of location.gsm_location.
    The code is -
    Code:
    <..snip..>
    conn = httplib.HTTPConnection("www.python.org")
    conn.request("GET","/index.html")
    r = conn.getresponse()
    d = r.read()
    conn.close()
    X, Y = d.split("</head>\n")
    date, Z = Y.split("\n<body>")
    str_out = str_out + date+"\n\n"
    import location
    a, b, c, d = location.gsm_location()
    <..snip..>
    Somehow, despite giving the conn.close() command, the GPRS connection still seems to be active. I can see the small gprs icon on the top left of the screen. Whenever GPRS is working, the location module does not work.

    I guess the whole problem boils down to closing the gprs connection. Any idea how that is done? This conn.close() does not seem to be doing the trick. In fact, the only way I can get rid of the "gprs active" icon (top-left) is if I shut down the application and re-open it.

    Any suggestions?

    Thanks
    How about using this?
    Code:
    conn = httplib.HTTPConnection("www.python.org")
    conn.request("GET","/index.html")
    r = conn.getresponse()
    d = r.read()
    conn.close()
    e32.ao_yield()
    X, Y = d.split("</head>\n")
    date, Z = Y.split("\n<body>")
    str_out = str_out + date+"\n\n"
    import location
    a, b, c, d = location.gsm_location()
    Pankaj Nathani
    www.croozeus.com

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Error using 'location' library while determining cell id

    hello kedar

    i also faced such a problem quite a long time before and that time the close method worked for me, but that also was not working everytime and i was getting NONE with gsm_location() everytime my GPRS was active, may be there we need to digg the actual sources.

    Regards,

  5. #5
    Regular Contributor
    Join Date
    Sep 2009
    Posts
    285

    Re: Error using 'location' library while determining cell id

    Hi,

    I tried adding e32.ao_yield() after the GPRS connection is closed. However, it still gave the same error.

    I have found a temporary work around. I just call location.gsm_location() before I create the GPRS connection, etc. This is NOT a good solution, as it only works the first time I run the code. ie After running the code once, I need to quit all applications (and wait for the GPRS connection to close), before restarting it.

    Thanks for the help. Will try and look at the code to see what could be causing this error. Any idea if anyone is looking at it right now?

Similar Threads

  1. Fail to build syexpat 1.3 under 2nd FP3
    By harry_zhang in forum Symbian
    Replies: 10
    Last Post: 2010-03-19, 10:24
  2. "Run Last Launched" did not complete normally !!
    By mockba in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 7
    Last Post: 2008-06-15, 13:15
  3. need information about j2me polish
    By rathikathangaraj in forum Mobile Java General
    Replies: 4
    Last Post: 2007-12-19, 09:01
  4. Can’t launch application on 6630
    By kaffemannen in forum Symbian
    Replies: 8
    Last Post: 2005-06-29, 10:49
  5. cell id - location
    By gheese in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2003-07-24, 10:18

Posting Permissions

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