×

Discussion Board

Results 1 to 10 of 10

Thread: Type problem?

Hybrid View

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Type problem?

    Hi

    I am pretty new to developing to S60 in Python, and I have a strange problem with positioning. For latitude I get 55..87698742437 (with two dots), I think is should have been 55.687698742437, longitude is ok. I use pys60 1.9, a Nokia 6210 and my code looks like

    Code:
    from sensor import *
    import e32, positioning
    
    def cb(event): 
        print "-------------------------" 
        print event 
        print "-------------------------" 
    
    if __name__ == '__main__':
        positioning.select_module(positioning.default_module()) 
        positioning.set_requestors([{"type":"service", "format":"application", "data":"test_app"}])
        print "***starts the position feed***" 
        positioning.position(course=1,satellites=1, callback=cb, interval=500000, partial=0)
        e32.ao_sleep(10)
        positioning.stop_position()
    As you can see it look pretty much as the example from the pys60 documentation, so I don't know what the problem is. The Nokia navigator software works like a charm, so the GPS unit should work.

    Do anyone have an idea what the problem could be. I looks something like some type casting thing or ?
    Last edited by innovated; 2009-04-09 at 17:08.

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

    Re: Type problem?

    hi innovated

    can you edit your post and code tags(#) provided in your editor so that we all can have a better view of your code and can spot the problem.

    Enjoy Pythoning
    Gaba88

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Re: Type problem?

    Hi Gaba88

    Have just edited the post with the code tag. So now it should be readable.

    I really hope someone can help me, I am about to go crazy

  4. #4
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Re: Type problem?

    Hi again

    This causes the exact same problem

    Code:
    tal = 55.1212122
    print 'test%f'%tal
    it prints
    > 55..212122
    so it substitutes the first 1 with a .

    It is only at my Nokia 6210 i get this mistake, If I try on my Mac it works like a charm.

    Code:
    >>> tal = 55.1212122
    >>> print 'test%f'%tal
    test55.121212

    I am pretty new to python so maybe it is a rookie mistake.

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Re: Type problem?

    Have also tried

    Code:
    tal = 'test2%.7f'%55.1212122
    print 'test',tal
    still
    > 55..2121220
    but now with a ending 0

  6. #6
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Re: Type problem?

    Problem gets more and more strange:

    Code:
    tallat = 85.1212122
    tallong = 12.1212122
    print 'lat :%.7f'%tallat
    print 'long:%.7f'%tallong
    print "-------------------------"
    
    > lat :85..212122
    > long:12.1212122
    > -------------------------
    This only happens on my Nokia 6210 with pys60 1.9, everything works on my laptop.

    What could possible be the differens with 85.1212122 vs 12.1212122 ? Very strange..

    New >
    I have found out that i changes after 49.1212122, 49.1212122 works but 50.1212122 fails like before
    Last edited by innovated; 2009-04-09 at 19:42.

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

    Re: Type problem?

    Quote Originally Posted by innovated View Post
    Code:
    tal = 55.1212122
    print 'test%f'%tal
    it prints
    > 55..212122
    Code:
    ===============================================
    Python for S60 1.9.0 RELEASE NOTES, 24.12.2008
    ===============================================
    
    ...
    
    Known issues
    ============
    1. Problem with decimal separator when the phone's locale uses a decimal 
       separator other than dot ('.')
    
    ...
    Check your locale settings.

  8. #8
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Re: Type problem?

    Quote Originally Posted by aya42 View Post
    Code:
    ===============================================
    Python for S60 1.9.0 RELEASE NOTES, 24.12.2008
    ===============================================
    
    ...
    
    Known issues
    ============
    1. Problem with decimal separator when the phone's locale uses a decimal 
       separator other than dot ('.')
    
    ...
    Check your locale settings.
    Ok thanks, have just checked it and it looks like it uses . (dot)

    Code:
    print locale.localeconv()['decimal_point']
    > .
    So hmm I don't know.
    Last edited by innovated; 2009-04-09 at 21:37.

Similar Threads

  1. Data Type problem Very Basic
    By moja_a in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2008-03-18, 17:11
  2. Problem MMC+USB Connection
    By Fede81 in forum Symbian
    Replies: 1
    Last Post: 2007-06-14, 06:13
  3. SIP content type
    By hlothman in forum Symbian Networking & Messaging (Closed)
    Replies: 8
    Last Post: 2006-05-17, 09:26
  4. nokia 7210 modem via IR doesn't work !
    By oussamaaiadi in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-03-06, 10:46
  5. Problem with Nokia D211 Linux Drivers
    By fiveam in forum Multimodecards
    Replies: 1
    Last Post: 1970-01-01, 02:00

Posting Permissions

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