You Are Here:

Community: Developer Discussion Boards

#1 Old (stupid q?) How to make my own modules - 2006-11-19, 05:06

Join Date: Nov 2006
Posts: 5
jibberia
Offline
Registered User
I've been messing around and reading on the forum, but I'm not 100% sure how to create my own modules.

Can somebody make it clear how I would make a few classes and be able to import them from many other scripts?


It seems like the e:\python\lib... um... used to work? but doesn't anymore... etc.

Sorry if this has been answered many times, I searched but couldn't find anything.

Thanks!
-kevin
Reply With Quote

#2 Old Re: (stupid q?) How to make my own modules - 2006-11-20, 12:05

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
Hi kevin and welcome to the forum

Fist of all which phone are you using? Writing your libraries is very simple, you just create a new python file like my_lib.py where you write you classes there, like HelloLib classes.

After depending on your phone you push your script to the phone. For second edition phones it's easy, push your script via bluetooth for example and install install it like library module or something like that.

For 3rd edition it a bit more complicated. You have to create an installation package (.sis) and then self-sign it (becomes .sisx)
The library directory is c:\resource or e:\resource depending on where you installed python (phone of memory card)
You can check few steps in here. Just skip the compiling parts, download the .pkg, modify it as it should, package and sign your package.

Good luck

LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#3 Old Re: (stupid q?) How to make my own modules - 2006-11-20, 12:10

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
And then I forgot

To use your own module like described previously, you can do like
Code:
import my_lib
# create new object
newObj = my_lib.HelloLib()
... some intersting stuff
or
Code:
from my_lib import HelloLib
# create new object
newObj = HelloLib()
... some intersting stuff
or
Code:
from my_lib import * # this import all classes from you library file
# create new object
newObj = HelloLib()
... some intersting stuff


LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#4 Old Re: (stupid q?) How to make my own modules - 2006-11-20, 23:07

Join Date: Nov 2006
Posts: 5
jibberia
Offline
Registered User
Thanks very much for the reply! I'm working on an N93, which is 3rd edition.

I'm doing super-rapid-development in a team of three people. We just got the phones a few days ago, and we're trying to glue together / produce a large-scale game. (and we only have two phones, some of us on macs, windows, linux, etc etc... really fun, y'know!?)

I was playing around last night, and discovered that sys.path is improperly set up on (the latest version of pys60/3rd ed? | the N93?). e:\Python\lib has been added to sys.path, but as a unicode string, which python doesn't like in this case.

So, in my main class, I'm just doing something like
Code:
import sys
sys.path.append('e:\Python\MyModules')
and all is well.
Reply With Quote

#5 Old Re: (stupid q?) How to make my own modules - 2006-11-21, 10:58

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
Have you tried e:\python\lib instead of e:\Python\lib? I've seen that already

But now I see you have a N93, it's a 3rd edition phone. So libraries are located in c:\resource or e:\resource depending where you installed PyS60.
If you add new C++ modules they are located in c:\sys\bin or e:\sys\bin

LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#6 Old Re: (stupid q?) How to make my own modules - 2006-11-21, 17:13

Join Date: Dec 2004
Posts: 646
jplauril's Avatar
jplauril
Offline
Forum Nokia Expert
jibberia, what version of PyS60 are you using? The \python\lib unicode problem was fixed several versions ago.
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
How to build GCCE target dsiorpaes Symbian Tools & SDKs 5 2008-09-18 07:54
[Pys60, 3rd Ed.] build problems MHOOO Python 3 2007-04-09 20:00
Compilation series 60 3rd edition asmobease Symbian Tools & SDKs 32 2006-09-13 10:46
Compilation series 60 3rd edition asmobease General Symbian C++ 3 2006-09-10 15:08
abld make files missing dalore General Symbian C++ 0 2003-06-13 13:40

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 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d81449X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZpythonQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZuserE5ftagQSxpythonX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ