Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User mooninite's Avatar
    Join Date
    Oct 2004
    Posts
    8
    Hi there,

    Let me start off saying I'm a C programmer, and that Python is a new language for me.

    I'm trying to write an if statement, which works under Python 2.5 on my Fedora machine, but S60 Python says it is an error. The code in question:

    Code:
                elif 'SEARCHING' in data:
                    print 'received SEARCHING: resending command'
                    self._send_command(cmd, ret_cb, err_cb, args)
    The error from S60 Python:
    Code:
    line 470, in _parse_result
        elif 'SEARCHING' in data:
    TypeError: 'in <string>' requires character as left operand

  2. #2
    Nokia Developer Champion gaba88's Avatar
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,701
    hi moonnite
    actually your elif statement seems to be ok if "searching" is a string and if it is in the function data.
    i think there must be a error in the other parts of your program like data.
    Other wise the statement is pitty correct.

    Enjoy Pythoning
    Gaba88

  3. #3
    Registered User mooninite's Avatar
    Join Date
    Oct 2004
    Posts
    8
    OK,

    'SEARCHING' is a string, and data is a string.

    I'm going to try some prints on data and make sure it contains a string and isn't coming through as NULL (or None I guess in Python). Would that cause this error?

    Thanks


    edit: I'm getting a string into "data" but I think it has some carriage returns in the first part of the string. Could this confuse S60 python?
    Last edited by mooninite; 2008-08-04 at 04:14.

  4. #4
    Nokia Developer Champion gaba88's Avatar
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,701
    Hi mooninite
    you are the getting error becoz before the in statement there can be a character not a string.
    Hope you got it now.

    Enjoy Pythoning
    Gaba88

  5. #5
    Registered User mooninite's Avatar
    Join Date
    Oct 2004
    Posts
    8
    Thanks, I'll switch it to data.find('SEARCHING') != -1 instead.

  6. #6
    Nokia Developer Champion gaba88's Avatar
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,701
    Quote Originally Posted by mooninite View Post
    Thanks, I'll switch it to data.find('SEARCHING') != -1 instead.
    Hi mooninite
    that will be a good option.

    Enjoy Pythoning
    Gaba88

Similar Threads

  1. XMl Parser Implementation for Symbian
    By ittiam in forum Symbian C++
    Replies: 26
    Last Post: 2009-09-16, 05:26
  2. i cant build helloworld project
    By akhin in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2008-12-22, 12:38
  3. CPbkContactEditorDlg customize
    By asdfghjkl_asdfghjkl in forum Symbian C++
    Replies: 5
    Last Post: 2008-08-05, 02:56
  4. My BuilderX (with S60 SDK 2.1.NET MS version) cannot build ARMI UREL
    By danielvidonyi@hotmail.com in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2006-05-04, 21:30
  5. User break point error in Grid
    By ag24master in forum Symbian User Interface
    Replies: 0
    Last Post: 2003-08-07, 08:20

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved