×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Jan 2008
    Posts
    56

    script split to more than 1 py file

    hey
    i did a script which is split into 3 files
    2 files each contains functions i wanted to split between them
    and 1 is the main script to run which imports the other 2 files.

    in the emulator i saw i cant put the scripts inside a subdir and
    i had to put all in the main python dir.

    on the phone it will be the same?
    all the script files have to get mixed with others ?
    or how i can make all my scripts into some subdir of my own.
    and when making a package how to make an icon for the main script only to appear as installed app.

    thx,
    roi

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

    Re: script split to more than 1 py file

    You can put some scripts in a separate folder so as not to mix them with the others. Here's how:
    Let's say you place scripts s1.py and s2.py in a folder called mydir.
    Write this at the beginning of your main script:

    import sys
    sys.path.append('C:\\Python\\mydir')

    ,or the path where you want to put mydir.
    Then, just import the scripts:
    import s1, s2

  3. #3
    Regular Contributor
    Join Date
    Jan 2008
    Posts
    56

    Re: script split to more than 1 py file

    thx
    but its not dynamic..
    i mean if i make a package of the scripts and some will choose
    to install to phone memory and some to a storage card.

  4. #4
    Super Contributor
    Join Date
    May 2004
    Location
    Tampere, Finland
    Posts
    524

    Re: script split to more than 1 py file

    Quote Originally Posted by roidayan View Post
    i did a script which is split into 3 files
    2 files each contains functions i wanted to split between them
    and 1 is the main script to run which imports the other 2 files.
    These two files are called "modules" in Python parlance.

    There are two scenarios you have with modules. If you need to use the modules in several applications, you need to install them under a location accessible by those applications. Publicly available Python modules are installed under \resource (in either drive, C: or E:). Ensymble command simplesis is useful in this case.

    If, on the other hand, you only need to access the modules from your application (or don't mind having separate copies for each application), you can simply pack them all in the main SIS file. Ensymble command py2sis is all you need in this case.

    Quote Originally Posted by roidayan View Post
    and when making a package how to make an icon for the main script only to appear as installed app.
    Ensymble provides you a default Python icon when using the py2sis command. You can provide your own SVG-T file (made in InkScape, for example) and use the --icon option.

Similar Threads

  1. Obfuscate python code
    By bercobeute in forum Symbian
    Replies: 20
    Last Post: 2008-02-26, 20:06
  2. File corrupted - with signed sis
    By annehj in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 4
    Last Post: 2007-12-10, 13:44
  3. Help needed with a 3gp file...
    By joedoe_1981 in forum Streaming and Video
    Replies: 0
    Last Post: 2007-07-18, 18:58
  4. Series 60 SDK Appwizard on windows xp
    By moonjoor in forum Symbian Tools & SDKs
    Replies: 15
    Last Post: 2003-12-24, 10:22

Posting Permissions

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