You Are Here:

Community: Developer Discussion Boards

#1 Old script split to more than 1 py file - 2008-01-26, 09:47

Join Date: Jan 2008
Posts: 56
roidayan
Offline
Regular Contributor
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
Reply With Quote

#2 Old Re: script split to more than 1 py file - 2008-01-27, 13:46

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Online
Forum Nokia Champion
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
Reply With Quote

#3 Old Re: script split to more than 1 py file - 2008-01-27, 14:57

Join Date: Jan 2008
Posts: 56
roidayan
Offline
Regular Contributor
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.
Reply With Quote

#4 Old Re: script split to more than 1 py file - 2008-01-27, 20:26

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
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.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Obfuscate python code bercobeute Python 20 2008-02-26 21:06
File corrupted - with signed sis annehj Carbide.c++ IDE and plug-ins 4 2007-12-10 14:44
Help needed with a 3gp file... joedoe_1981 Streaming and Video 0 2007-07-18 19:58
Series 60 SDK Appwizard on windows xp moonjoor Symbian Tools & SDKs 15 2003-12-24 11:22
changing script language in asp file for internet toolkit a211135 General Browsing 0 2002-10-30 21:04

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia