×

Discussion Board

Results 1 to 9 of 9

Thread: noob question

  1. #1
    Registered User
    Join Date
    Mar 2008
    Location
    Sydney, Australia
    Posts
    8

    noob question

    Hi guys,
    I'm very new to python, I have this application and because didn't know how to split my classes to different files, I have all my classes in one .py file. how can I have one file per class?

    Cheers,
    Ali Shafai

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

    Re: noob question

    Quote Originally Posted by AliShafa View Post
    Hi guys,
    I'm very new to python, I have this application and because didn't know how to split my classes to different files, I have all my classes in one .py file. how can I have one file per class?

    Cheers,
    Ali Shafai
    Hi ali again
    really sorry but can you explain you question a bit more in detail. really getting nothing from your present post.
    thnks

  3. #3
    Registered User
    Join Date
    Mar 2008
    Location
    Sydney, Australia
    Posts
    8

    Re: noob question

    Ok, if I have a class1.py and have my calss1 object defined there, how do I use it in my class2.py?
    I tried "import class1", but class1 is not a module (or library, I don't know what they are called).

    Cheers,
    Ali

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

    Re: noob question

    Quote Originally Posted by AliShafa View Post
    Ok, if I have a class1.py and have my calss1 object defined there, how do I use it in my class2.py?
    I tried "import class1", but class1 is not a module (or library, I don't know what they are called).

    Cheers,
    Ali
    hi ali
    thanks for explaining the question.
    if u want to use you one .py file in another better make it as a library file i.e. .pyd. then call it back in ur script ok.
    i dont think that in PyS60 you can call another file in a script but make it clear its a assumption.
    give a feedback

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

    Re: noob question

    hi ali again
    plz have a look at this wiki article.

  6. #6
    Nokia Developer Moderator
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: noob question

    Quote Originally Posted by AliShafa View Post
    Ok, if I have a class1.py and have my calss1 object defined there, how do I use it in my class2.py?
    I tried "import class1", but class1 is not a module (or library, I don't know what they are called).

    Cheers,
    Ali
    In order to use your .py files as modules, you have to tell Python where to look for them:
    Code:
    import sys
    
    #Let's say your myclass.py file is in C:\\myfolder
    
    sys.path.append("C:\\myfolder")
    
    #Now, just import it
    
    import myclass

  7. #7
    Registered User
    Join Date
    Mar 2008
    Location
    Sydney, Australia
    Posts
    8

    Re: noob question

    Thanks guys, works like a charm.
    except that when I create the SIS file, it's trying to find the .py files I references in the directory I setup for them. how can I compile everything in one sis?

    Cheers,
    Ali Shafai

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

    Re: noob question

    hi ali
    there are lots of thread related to making standalone applications search the forum and look at this link

  9. #9
    Nokia Developer Moderator
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: noob question

    Quote Originally Posted by AliShafa View Post
    Thanks guys, works like a charm.
    except that when I create the SIS file, it's trying to find the .py files I references in the directory I setup for them. how can I compile everything in one sis?

    Cheers,
    Ali Shafai
    Use Ensymble's "simplesis" function that will create a sis of the directory (and when you install that sis, the files in it will be placed on the phone accordingly).

    See this post of mine for guidance.

    I hope I understood your question. If not, just say so and I'll try again

Similar Threads

  1. Just a noob question
    By daviddu54 in forum Mobile Java General
    Replies: 3
    Last Post: 2007-11-19, 09:40
  2. 6101 Midi noob question...
    By furiousangle in forum General Development Questions
    Replies: 2
    Last Post: 2006-04-29, 15:01
  3. Noob question re: streaming/networking
    By SM2005 in forum Streaming and Video
    Replies: 6
    Last Post: 2005-12-09, 15:20
  4. very noob question
    By totoscarantino in forum Mobile Java General
    Replies: 2
    Last Post: 2005-03-24, 12:55
  5. noob question
    By ppe_manager in forum Mobile Java General
    Replies: 1
    Last Post: 2003-10-19, 09:17

Posting Permissions

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